Telerik radGrid -ItemTemplate,EditTemplate


  • Browser side: Use normal controls – a lot like gridview (label, hidden, etc)
  • Server side a little different
  • Must grab control[1]. Control[0] is a literal – I suppose the start of the <td>.

Browser Side:

<telerik:GridTemplateColumn Display=”false” UniqueName=”ReceiptItemID”>


<asp:HiddenField ID=”hdnReceiptItemID” runat=”server” Value=”<%# Item.ParkedReceiptItemID %>” />



<asp:HiddenField ID=”hdnReceiptItemID” runat=”server” Value=”<%# Item.ParkedReceiptItemID %>” />




<telerik:GridTemplateColumn HeaderText=”AccountNumber” UniqueName=”AccountNumber” >


<asp:Label ID=”lblAccountNumber” runat=”server” Text='<%# Item.AccountNumber %>’ ></asp:Label>



<uc1:ctlCombo ID=”cboAccountNumber” ClientIDMode=”Static” runat=”server” Text='<%# Item.AccountNumber %>’ />




Server side:

//Get all the new values of the edited row.

GridEditableItem rgEditedItem = (GridEditableItem) e.Item;



// Label lbl = (Label) rgEditedItem[“ReceiptItemID”].Controls[1];

HiddenField hdn = (HiddenField)rgEditedItem[“ReceiptItemID”].Controls[1];


// int ReceiptItemID = lbl.Text.toInt(0);

int ReceiptItemID = hdn.Value.toInt(0);


// update account number if it changed

ctlCombo cbo = (ctlCombo)rgEditedItem[“AccountNumber”].Controls[1];

if (cbo.PreviousValue != cbo.Text && ReceiptItemID > 0)


int iret = _parkedReceiptItem.update_Account(ReceiptItemID, cbo.Text, globals.StaffID, ref iError, ref strErrorShort, ref strErrorLong);

if (iError < 0) globals.lblError = globals.ErrorMessage(strErrorShort, strErrorLong, “Problem with account”, “rgItems_UpdateCommand.account”, -2223);




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: