Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Jun 25, 2007 02:31 PM|LINK
Thanks for the reply.
Yes it is a button click event that triggers the code. When I do check even the GridView columns count it is 0 so I'm losing the data. The confusing part though is that this code worked in asp.net 1.1. The only difference is that I'm using AJAX (http://ajax.asp.net/).
I can't call DataBind() because I have text boxes that are edited and I want to check the user's input first (ensure only numbers entered) and then save the items to a DataTable as shown below:
public DataTable getUpdatedDatagrid(GridView grid,DataTable dt1,int userId)
//Loop through GridView Items
foreach (GridViewRow grdRow in grid.Rows)
TextBox txt_Day = (TextBox)(grdRow.FindControl("txtDay"));
TextBox txt_PremiseID = (TextBox)(grdRow.FindControl("txtPremiseID"));
TextBox txt_M1 = (TextBox)(grdRow.FindControl("txtM1"));
DataRow dr = dt1.NewRow();
dr = userId;
dr = Convert.ToInt32(txt_Day.Text.Trim());
dr = Convert.ToDecimal(txt_PremiseID.Text.Trim());
dr = Convert.ToDecimal(txt_M1.Text.Trim());
catch (Exception ex)
Session["CurrentError"] = ex.Message;
I'm not using the ObjectDataSource or SQLDataSource because I'm inheriting this project and I'm thinking it would be a bigger project to change the code rather than just modifying the existing code.
Any help would be greatly appreciated.
Thanks, Bill N