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

Using context menu on grid to update data

3 Answers 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tri Nguyen
Top achievements
Rank 1
Tri Nguyen asked on 25 May 2011, 11:32 PM
Hello,

Is there a way to have a template column with a linkbutton containing a pop-up context menu, allowing to update the data on that row? I have a grid populated with data (from the NeedDatasource handler). I'd like to allow user to left-click on the link button to pop-up a menu, and select a menu item which will update the underline record's data according to the menu item's value. I couldn't find any message/knowledge base to allow me to pass the datakey's value from the client to server to pass on to the DAL. I want to use left-click on a linkbutton to restrict users only to click on the button to activate the allowable command (and also, make it more user-friendly!)

Since I don't know where to start, it'd be tough to provide some code. Any help would be greatly appreciated.

Tri.

3 Answers, 1 is accepted

Sort by
0
Tri Nguyen
Top achievements
Rank 1
answered on 01 Jun 2011, 10:44 PM
Hopefully, this is not impossible to do.
0
Tsvetina
Telerik team
answered on 07 Jun 2011, 08:49 AM
Hello Tri,

I am attaching a sample project which shows how to put rows into edit mode on context menu click. It answers your question about passing the data key value and with a few modifications it should fit in your scenario.

Kind regards,
Tsvetina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Tri Nguyen
Top achievements
Rank 1
answered on 07 Jun 2011, 04:16 PM
Hello, Tsvetina.

Thanks for your response and the code. Somewhat, I think your sample is similar, if not the same, with this. What I was after is to have either a LinkButton or Button on a template column, which would show a popup menu. Don't know if it's possible or not, but that's what I want to do. Again, thanks.
<telerik:GridBoundColumn HeaderText="CustomerID" DataField="CustomerID" HeaderButtonType="TextButton"
    UniqueName="CustomerID" SortExpression="CustomerID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Contact Name" DataField="ContactName" HeaderButtonType="TextButton"
    UniqueName="ContactName" SortExpression="ContactName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Company" DataField="CompanyName" HeaderButtonType="TextButton"
    UniqueName="CompanyName" SortExpression="CompanyName">
</telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn>
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkPopup" runat="server" Text="Show Menu" OnClientClick="RowClick"></asp:LinkButton>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn>
                        <ItemTemplate>
                            <input id="Button1" type="button" value="Show Menu" onclick="RowClick" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
Tags
Grid
Asked by
Tri Nguyen
Top achievements
Rank 1
Answers by
Tri Nguyen
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or