Results 1 to 2 of 2

Thread: i cannot get values from the grid

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    11

    i cannot get values from the grid

    I have populated a datagrid on page load.The grid contain a bound column and 3 template columns.The template columns contain dropdownlist and labels.i have a button on the page and the action of that button is to get the values from the grid and print it on the label (lblMessage.Text) which is also suitated on the page.Now the problem is when i click the button the information of bound columns is displayed but the information of the template column is invisible.It doesnt gives error but the values are not printed on the label
    my code is

    private void btnAddToCart_Click(object sender, System.EventArgs e)
    {

    string Degree="";

    foreach(DataGridItem objDataGridItem in dgPrice.Items ) {

    Degree =Degree+ ((DropDownList)objDataGridItem.FindControl("drpQty")).SelectedItem.Text;

    Degree =Degree+((Label)objDataGridItem.FindControl("lblSizeInches")).Text;

    }

    lblMessage.Text=Degree;
    }

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

    Re: i cannot get values from the grid

    Please don't anyone post to this thread as it's a duplicate.

    http://www.vbforums.com/showthread.php?t=431135

    Pressed the New Thread button instead of Post Reply, hey? Nice to let people know and maybe ask a Mod to delete it.
    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

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