Reputation: 11483
I want to access controls and update database with their value. Notice using following code:
void grdList_UpdateCommand(object source, GridCommandEventArgs e)
{
string str = ((RadTextBox)e.Item.FindControl("txtLookupItemValue")).Text;
}
I have access to control txtLookupItemValue, but it contains before-edit content, not actual value that user has entered.
Upvotes: 0
Views: 6174
Reputation: 1561
I think you can get the value when the grid is updating. E.g:
protected void GridUpdating(object sender, GridViewUpdateEventArgs e)
{
string str = (RadTextBox)this.yourGridviewName.Rows[e.RowIndex].FindControl("txtLookupItemValue").Text;
}
Then add this to the gridview on the aspx:
OnRowUpdating="GridUpdating"
Upvotes: 0
Reputation: 90
have you tried setting the string during the edit event:
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
string str = ((RadTextBox)e.Item.FindControl("txtLookupItemValue")).Text;
}
Then update your DB and rebind the gridview to display the updated row.
Upvotes: 1