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

[Solved] getting the item contents in the text box fied

2 Answers 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saran kumar
Top achievements
Rank 1
Saran kumar asked on 28 Dec 2009, 02:26 PM
<telerik:GridTemplateColumn HeaderStyle-VerticalAlign="Middle" UniqueName="TypeOfLead" 
                                            HeaderText="Action" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="40">  
                                            <ItemTemplate> 
                                                <asp:LinkButton ID="imgbActivityEdit" runat="server" ImageUrl="../Images/icons/icon_edit.gif" 
                                                    ToolTip="Edit" OnCommand="gvActivity_RowEditing" CommandArgument='<%# Eval("[Activity_Id]") %>'>  
                                                    <img src="../Images/icons/icon_edit.gif" alt="Edit"/></asp:LinkButton> 
                                                <asp:LinkButton ID="imgbActivityDelete" runat="server" ImageUrl="../Images/icons/icon_delete.gif" 
                                                    ToolTip="Delete" OnCommand="ActivityDelete_Click" CommandArgument='<%# Eval("[Activity_Id]") %>'>  
                                                    <img src="../Images/icons/icon_delete.gif" alt="Delete"/></asp:LinkButton> 
                                                <asp:Label ID="lblActivityId" runat="server" Text='<%# Eval("[Activity_Id]") %>' 
                                                    Visible="False"></asp:Label> 
                                                <asp:Label ID="lblActivityType" runat="server" Text='<%# Eval("[Activity_Type]") %>' 
                                                    Visible="False"></asp:Label> 
                                            </ItemTemplate> 
                                        </telerik:GridTemplateColumn> 
protected void gvActivity_RowEditing(object sender, CommandEventArgs e)  
    {  
 
                txtDate.Text = ((GridTableCell)gvLeadsHistory.Items[0].Controls[0]).ToString();  
          
 
 
    } 
hi please refer the attached, there i have template columns edit, and delete.

im using Commandevent args alone, since im done with delete and other using the same i should use it for edit too.
in above code im getting Telerik.Web.UI.GridTableCell as out put in the text box. i need the row contents please help.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Dec 2009, 02:55 PM
Hello Saran,

You can access the item using the NamingContainer property of LinkButton which invoke the postback.

CS:
 
    protected void gvActivity_RowEditing(object sender, CommandEventArgs e) 
    { 
        LinkButton lnkButton = (LinkButton)sender; 
        GridDataItem item = (GridDataItem)lnkButton.NamingContainer; 
        string str = item["CustomerID"].Text; 
    } 

-Shinu.
0
Saran kumar
Top achievements
Rank 1
answered on 29 Dec 2009, 05:53 AM
Really helpful at the correct time, it worked very well at my end. thanks a lot for yout timely help shinu.
Tags
Grid
Asked by
Saran kumar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Saran kumar
Top achievements
Rank 1
Share this question
or