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

[Solved] insert with grid

3 Answers 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Farshad heidary
Top achievements
Rank 1
Farshad heidary asked on 17 Feb 2010, 07:47 PM
hi guys.
i have nested grid view. and i wanna insert an item to Detail table.
i have a Button And a Text box in MasterTable

this is my code:
<table border="0px" cellpadding="0px" cellspacing="0px"
                           <tr> 
                           <td align="right"
                               <asp:TextBox Style="direction:rtl" ID="txtComment" ToolTip='<%# Eval("SharedUserID") %>' runat="server" TextMode="MultiLine" Width="200" Rows="1"></asp:TextBox> 
                           </td> 
                           <td valign="bottom" align="right"
                               <asp:Button ID="btnComment"  
                               CommandName="DropComment" 
                               CommandArgument='<%# Eval("SharedUserID") %>' 
                               runat="server" Text="ارسال Ú©Ø§Ù…نت" /> 
                           </td> 
                           </tr> 
                           </table> 
                    </td> 
                    </tr> 
                    </table> 

this code is in my Master Table.
i can access to CommandName and Argument in  ItemCommand.
how i can access to valu of Text box?

tnx 4 ur attention 

Regards...

3 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetoslav
Telerik team
answered on 18 Feb 2010, 07:07 AM
Hello Farshad,

You can just search for the box control within the command item as follows: 

e.Item.FindControl("txtComment")

I hope this helps.

Regards,
Tsvetoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Accepted
Princy
Top achievements
Rank 2
answered on 18 Feb 2010, 07:31 AM
Hi,

Please try the code snippet belwo to access the TextBox in the EditForm in the ItemCommand:

C#
 protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
        { 
            if (e.CommandName == "DropComment"
            { 
                GridDataItem editedItem = (GridDataItem)e.Item; 
                string str = ((TextBox)editedItem.EditFormItem.FindControl("txtComment")).Text; 
            } 
        } 


Thanks,
Princy
0
Farshad heidary
Top achievements
Rank 1
answered on 18 Feb 2010, 08:05 AM
tnx Princy and Admin. for reply

both ur answer is correct and work okey.

tnx again

regards

Tags
Grid
Asked by
Farshad heidary
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Princy
Top achievements
Rank 2
Farshad heidary
Top achievements
Rank 1
Share this question
or