Reputation: 1456
I have this Telerik radgrid
| Encryption Key | Password to encode | Edit column |
-----------------------------------------------------
| A_Key | A_password | Edit button |
When I press the edit button, you can edit the encryption key and the password via textboxes (which works fine).
What I want to do is:
-When I press the edit button, I want to add an imagebutton next to the encryption key textbox that will allow me to generate a key by clicking it, like so:
| Encryption Key | Password to encode | Edit column |
------------------------------------------------------------
|[A_Key ][Generate] | [A_password ] | [Save] |
Is there a way to add a button inside an editor cell of a Telerik RadGrid?
I have looked everywhere, I haven't found any way to do this, even on the Telerik website/forums.
Thanks!
Upvotes: 1
Views: 7468
Reputation: 1456
Finally, I have used a solution similar to Dhaval's. Using server side controls wasn't optimal for me, so I used jquery to generate keys client side.
<telerik:GridTemplateColumn UniqueName="Generate" DataField="" HeaderText="" AllowFiltering="false">
<ItemTemplate>
</ItemTemplate>
<EditItemTemplate>
<img id="Generate" src="Images/generate.gif" onclick="javascript: GenerateEncryptionKey();" alt="Generate key" title="Generate key"/>
</EditItemTemplate>
</telerik:GridTemplateColumn>
What this will do is it will create a column for the button only. Using CSS, I can make it look like a single column.
| Encryption Key | | Password to encode | Edit column |
------------------------------------------------------------
|[A_Key ]| [Generate] | [A_password ] | [Save] |
I'm not displaying column lines, so it looks like 1 large column rather than 2 small columns.
Thanks to all for your answers!
Upvotes: 0
Reputation: 1127
<telerik:GridTemplateColumn DataField="Status" HeaderText="Status" UniqueName="Status">
<ItemTemplate>
<%# Eval("Status") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="txtBx" />
<asp:Button id="btn" OnClick="btn_Click" runat="server" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
And create a onclick event function on back end like this:
protected void btn_Click(object sender, EventArgs e)
{
// Your Code Goes here
}
Upvotes: 3