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

Extract RadGrid Popup values

1 Answer 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Trisha
Top achievements
Rank 1
Trisha asked on 30 Jul 2012, 09:37 AM
Hi,

I have a grid, with popup form template. On initial use, I am able to extract the template values (textbox input). But on succeeding input, the value of the textbox (txtName) is always empty even if i change the textbox values.  Below is my code:

<

 

 

telerik:RadGrid ID="RadGrid1" AutoGenerateEditColumn="false" runat="server"

 

 

 

AllowAutomaticDeletes="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False"

 

 

 

AllowPaging="True" AllowSorting="true" OnItemCommand="gridRequestList_ItemCommand" >

 

 

 

 

<MasterTableView EditMode="PopUp" CommandItemDisplay="Top" AutoGenerateColumns="false"

 

 

 

AllowAutomaticInserts="false" AllowAutomaticUpdates="false" >

 

 

 

<Columns>

 

columns here

 

 

</Columns>

 

 

 

 

<EditFormSettings InsertCaption="Setup Info" EditFormType="Template">

 

 

 

<FormTemplate> code here </FormTemplate>

 

 

 

</EditFormSettings>

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

 



protected

 

 

void grid_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)

 

{

 

 

if (e.CommandName.Equals(RadGrid.PerformInsertCommandName))

 

{

 

 

    string txtName = ((TextBox)e.Item.FindControl("txtName")).Text;

 

}

}

Thanks.
tj

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Jul 2012, 10:55 AM
Hello,

Try accessing the controls in FormTemplate as shown below.
C#:
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
 if (e.CommandName == "PerformInsert")
 {
   GridEditableItem editedItem = (GridEditableItem)e.Item;
   TextBox txt = (TextBox)((Telerik.Web.UI.GridDataItem)(editedItem)).EditFormItem.FindControl("txtName");
 }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Trisha
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or