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

RadGrid ItemCommand, get textbox value when default radgrid's Insert link is clicked

1 Answer 264 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vlad
Top achievements
Rank 1
Vlad asked on 16 Sep 2011, 02:31 PM
I am not using any datasource controls, all db access done only in BusinessLayer, and front end is not aware of any built-in .NET data objects either. (no DataTable). The underlying type which grid is bound to is keyvaluepair<string,string>.

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
   if (e.CommandName==RadGrid.PerformInsertCommandName )
            {
 
                // how to get text that user just typed in textbox in the grid ?
                      // so I can pass it to Busnesslayer for validation and handling.
 
            }
}

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Sep 2011, 06:51 AM
Hello Vlad,

Try the following code snippet to achieve the scenario.
C#:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
   {
       if (e.CommandName == RadGrid.PerformInsertCommandName)
       {
           GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;
           TextBox txtbox = (TextBox)item.FindControl("TextBox1");
           string strtxt = txtbox.Text;
       }
   }

Thanks,
Shinu.
Tags
General Discussions
Asked by
Vlad
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or