|
-
Oct 3rd, 2006, 02:47 PM
#1
Thread Starter
New Member
[1.0/1.1] i canot get values from datagrid
I am populating grid dynamically on page load .it contains webcontrols like dropdown and labels.now i am trying to get values from the grid but i am unable to get the values.
foreach(DataGridItem objDataGridItem in dgPrice.Items )
{
DropDownList objDropDownlist = (DropDownList)(objDataGridItem.Cells[1].Controls[1]);
Degree =Degree+ ((DropDownList)objDataGridItem.FindControl("drpQty")).SelectedItem.Text;
Degree =Degree+objDataGridItem.Cells[1].Text;
}
This is bit of my code which shows what i am trying to do.
Please help ma ASAP
-
Oct 3rd, 2006, 04:42 PM
#2
Re: [1.0/1.1] i canot get values from datagrid
You've already created objDropDownList, but you're not using it, why?
Also, step through your code to see whether you're actually able to find the controls you want.
And when you run this code, what actually happens?
-
Oct 4th, 2006, 07:16 AM
#3
Thread Starter
New Member
Re: [1.0/1.1] i canot get values from datagrid
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;
}
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
|