Results 1 to 10 of 10

Thread: [RESOLVED] how do I?... get the value of data inside of a cell?

Hybrid View

  1. #1

    Thread Starter
    Addicted Member KingSatan's Avatar
    Join Date
    Feb 2006
    Posts
    185

    Resolved [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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member KingSatan's Avatar
    Join Date
    Feb 2006
    Posts
    185

    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.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Addicted Member KingSatan's Avatar
    Join Date
    Feb 2006
    Posts
    185

    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.

  6. #6

    Thread Starter
    Addicted Member KingSatan's Avatar
    Join Date
    Feb 2006
    Posts
    185

    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:
    1. public void DeleteDGMI(object source, DataGridCommandEventArgs e)
    2.             {int c;
    3.             c=System.Convert.ToInt32(e.CommandArgument);
    4.             class2.DeleteItems(c);
    5.             BindDataDG();
    6.             }
    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.

  7. #7

    Thread Starter
    Addicted Member KingSatan's Avatar
    Join Date
    Feb 2006
    Posts
    185

    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.

  8. #8
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    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

  9. #9

    Thread Starter
    Addicted Member KingSatan's Avatar
    Join Date
    Feb 2006
    Posts
    185

    Re: [RESOLVED] how do I?... get the value of data inside of a cell?

    oh using sql server 2005

  10. #10
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    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
  •  



Click Here to Expand Forum to Full Width