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

[Solved] button to change a value in a row

1 Answer 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kyle
Top achievements
Rank 1
kyle asked on 08 Mar 2008, 04:40 PM
I am looking to see if this is even possible.  I would like to have a button in a row of the grid (normal mode (not edit mode) that a user can click to change a value up or down for that row.  I figure I can use the itemdatabound event to wire of the event etc. But I am unsure of how i can get access to the row I am on to change the needed value?  If even possible.

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 10 Mar 2008, 07:33 AM
Hello kyle,

Please use ItemCreated to attach the event instead of ItemDataBound. You can use also event bubbling to achieve the same ( you will need to specify CommandName for this button).  Here is an example for ItemCommand:

<Columns>
  <telerik:GridTemplateColumn>
     <ItemTemplate>
        <asp:Button ID="Button1" CommandName="MyCommand" runat="server" Text="MyCommand" />
     </ItemTemplate>
  </telerik:GridTemplateColumn>
  <telerik:GridTemplateColumn>
     <ItemTemplate>
        <asp:DropDownList ID="DropDownList1"runat="server" />
     </ItemTemplate>
  </telerik:GridTemplateColumn>
...

if(e.CommnadName == "MyCommand")
{
    DropDownList DropDownList1 = (DropDownList)e.Item.FindControl("DropDownList1");
}



Greetings,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
kyle
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or