1

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!

2
  • Is this asp.net mvc? If so, this might be helpful: stackoverflow.com/questions/9216168/…. Commented Mar 19, 2012 at 18:27
  • No, I'm not using MVC. I'd prefer having the edit fields in the radgrid itself, not in a popup div. The editorTemplate will be my last resort tho, thanks. Commented Mar 19, 2012 at 18:41

2 Answers 2

3
 <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
        }
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot! That's not exactly what I'm looking for, but I figured it out thanks to you.
0

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.