|
-
Apr 2nd, 2007, 10:11 AM
#1
Thread Starter
Addicted Member
[RESOLVED] how do I?... get the value of data inside of a cell?
im having trouble and ive hit a big brick wall....
i just need to get the value insside of a cell
its the value of a foreign key, once something is selected from say a dropdown list then it queries everything with that intID into that dataset so it would be the same throughout the column until someting else is selected from that drop down list, then it will still all be the same value, but different from the last...you know???
just trying to get a value inside of a cell....
the column in which the cell is located isnt visible by the way
because who wants to see a bunch of intIDs
-
Apr 2nd, 2007, 07:01 PM
#2
Re: how do I?... get the value of data inside of a cell?
Please always specify your version when posting. Also, a cell of what? Finally, you say "dropdownlist", which is a WebForms control. Is this an ASP.NET application and you just haven't said or do you actually mean ComboBox? Please provide all the relevant information and be careful with nomenclature when posting so we don't have to guess. It would be quite possible to spend some time answering this question only to find out that the information provided was completely irrelevant. Assume that we know nothing about your project, because that is the case.
-
Apr 3rd, 2007, 10:21 AM
#3
Thread Starter
Addicted Member
Re: how do I?... get the value of data inside of a cell?
sorry sorry i was in a hurry....
im using
VS 2003 c#
sql server 2000
ok i have a web app which shows different menu items for 4 restaurants
you select a restaurant from a drop drown list box
it shows the restaurants....
of course there is a restaurant ID so the dataset will show the correct menu in the datagrid
it works all fine and gravy BUT....
i need the Restaurant ID to add a new item so that item only pops up when i select the restaurant in which i added it to
and its in an invisible template column which i ID'd "menuID" in the html design editor of VS 2003
and i need the intID for the menuitemID so the stored procedure know which row to delete
also i havnt a clue on how to cause a manual post back of a page after cicking a button which doesnt cause a postback....
sorry folks a weeee bit tired and fatigued
Last edited by KingSatan; Apr 3rd, 2007 at 05:44 PM.
-
Apr 3rd, 2007, 05:37 PM
#4
Re: how do I?... get the value of data inside of a cell?
After reading your post I have inferred that it's actually an ASP.NET app. It was fun reading it all though.
-
Apr 6th, 2007, 11:36 AM
#5
Thread Starter
Addicted Member
Re: how do I?... get the value of data inside of a cell?
yeah it is and im still stuck trying to get data from the intID cell of the e.item.itemindex
you know...
im trying to get the id of the row i want to delete
Last edited by KingSatan; Apr 6th, 2007 at 12:51 PM.
-
Apr 9th, 2007, 11:40 AM
#6
Thread Starter
Addicted Member
Re: how do I?... get the value of data inside of a cell?
i found out a way to do it with the help of a co-worker
i made my delete column a tamplate column
in the aspx page theres something called command arguements where the delete template column aspx code is then put CommandArgument='<%# DataBinder.Eval(Container, "DataItem.intItemID") %>' (or whatever other template column text you need to use
then in whatever subroutine your using just set e.CommandArgument as a variable and convert to whatever needed
and pass into the custom class
heres an example
vb Code:
public void DeleteDGMI(object source, DataGridCommandEventArgs e)
{int c;
c=System.Convert.ToInt32(e.CommandArgument);
class2.DeleteItems(c);
BindDataDG();
}
and the aspx
Code:
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton runat="server" Text="Delete" CommandName="Delete" CommandArgument='<%# DataBinder.Eval(Container, "DataItem.intItemID") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
i needed to use the property builder to make template columns though
Last edited by KingSatan; Apr 9th, 2007 at 12:00 PM.
-
Jan 4th, 2008, 11:55 AM
#7
Thread Starter
Addicted Member
Re: [RESOLVED] how do I?... get the value of data inside of a cell?
ok im on this again.....
ive done the admin portion of an app which displays links to all pages recently updated on a website. and the admin is allowed to decide how many updates are displayed in the user control, so he puts the number in a db in its own datatable. what im having trouble getting is the value of this one integer inside the table. you know? being able to grab it and use it as a variable in my code...
what i want is the value which is in row 1 column 1 cell 1 in this datatable
Last edited by KingSatan; Jan 4th, 2008 at 12:24 PM.
-
Jan 4th, 2008, 01:54 PM
#8
I wonder how many charact
Re: [RESOLVED] how do I?... get the value of data inside of a cell?
It sounds like you moved to an ADO.NET question.
use dataReader.ExecuteScalar to get the value:
"Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored."
- http://msdn2.microsoft.com/en-us/lib...utescalar.aspx
-
Jan 4th, 2008, 01:57 PM
#9
Thread Starter
Addicted Member
Re: [RESOLVED] how do I?... get the value of data inside of a cell?
-
Jan 4th, 2008, 09:23 PM
#10
I wonder how many charact
Re: [RESOLVED] how do I?... get the value of data inside of a cell?
Same applies for sql 2005.
Or, did you want an example of T-SQL to write to retrieve the value?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|