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

Button outside the grid

1 Answer 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dawson
Top achievements
Rank 1
Dawson asked on 08 May 2014, 09:13 AM
Hi
i have a grid which has insert and edit. I have a button outside the grid. Onclick of that during insert , i want some textbox to be filled with some default values. How can I get this done?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 May 2014, 09:25 AM
Hi Dawson,

Please try the following code snippet in the button click which is outside the grid, to set a value in insert form:

C#:
protected void btnFill_Click(object sender, EventArgs e)
{
  if (RadGrid1.MasterTableView.IsItemInserted)
  {
    //Accessing the InsertForm items
    GridEditableItem insertItem = (GridEditableItem)RadGrid1.MasterTableView.GetInsertItem();
    TextBox txtOrderID = (TextBox)insertItem["OrderID"].Controls[0];
    txtOrderID.Text = "Some Value";       
  }
}

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