This is a migrated thread and some comments may be shown as answers.

Custom Save Button isn't working

1 Answer 154 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 16 Mar 2014, 02:51 AM
Hello,

I can't seem to use a custom Save button work. Can someone point me to where I'm going wrong.

Thanks
Thomas

protected void btnSave_Click(object sender, EventArgs e)
{
Button btn = (Button)sender;

foreach (GridEditableItem item in radNotifications.EditItems)
{
string ss = item["PersonalNote"].Text;
Business.PushNotifications.SaveNote((int)Session["CompanyId"], ss, new Guid(btn.CommandArgument.ToString()));
break;
}

radNotifications.EditIndexes.Clear();
BindGrid();
}

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Mar 2014, 06:21 AM
Hi Thomas,

I guess you want to access the edit form items on a button click. Please try the following code snippet.

C#:
protected void btnSave_Click(object sender, EventArgs e)
{
  foreach (GridDataItem item in RadGrid1.EditItems)
  {
    GridEditableItem edititem = (GridEditableItem)item.EditFormItem;
    TextBox txt = (TextBox)edititem["PersonalNote"].Controls[0];// Access a BoundColumn in edit
    string name = txt.Text; // gets the value 
  }
}

Thanks,
Princy
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or