Reading text out of textbox in Radgrid
Posted
by Christophe
on Stack Overflow
See other posts from Stack Overflow
or by Christophe
Published on 2010-05-06T13:29:39Z
Indexed on
2010/05/07
6:28 UTC
Read the original article
Hit count: 729
I have a Radgrid with 2 Textboxes and 2 DatePickers. The idea is that I have a grid with a Property name, value, valid from and until. I'm filling the first Textbox myself, the user has to fill in the value, from and until. Filling in the propertynames: (In the pageload)
foreach (String s in testProperties) {
DataRow dr = dt.NewRow();
dr[0] = s;
dr[1] = "";
dr[2] = "";
dr[3] = "";
dt.Rows.Add(dr);
}
When the user hit "Save" I have to read out all the data he filled in. (In the btnSave click)
foreach (GridDataItem dataItem in RadGrid1.Items) {
String[] str = new String[3];
str[0] = ((TextBox)dataItem["col2"].FindControl("TextBox2")).Text;
str[1] = ((RadDatePicker)dataItem["col3"].FindControl("RadDatePicker1")).SelectedDate.ToString();
str[2] = ((RadDatePicker)dataItem["col4"].FindControl("RadDatePicker2")).SelectedDate.ToString();
properties.Add(((TextBox)dataItem["col1"].FindControl("TextBox1")).Text, str);
}
Now this is where I have the problem. When i read out the data all my 'str' have the value "" instead the data that the user fills in.
Question is, how comes my values in the texboxes remain ""? Or is their a better way to read out the data?
© Stack Overflow or respective owner