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

[Solved] RadGrid textbox copy functionality

2 Answers 176 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Durga
Top achievements
Rank 1
Durga asked on 16 Sep 2009, 07:41 AM
Hi,

I've a RadGrid that is editable, here i need to copy data from one textbox control to another textbox control.

Please provide solution.

Thanks in Advance
Durga


2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Sep 2009, 09:23 AM
Hi Durga,

I am not sure what exaclty you requirement is. From what I understood you are trying to copy a textbox value to another textbox in the edit form. Here I have implemented a form template editform with two textboxes and one copy button. On clicking the copy button text from one texbox will be copied to the second.

ASPX:
 
     <EditFormSettings EditFormType="Template" > 
                         <FormTemplate> 
                             <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
                             <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> 
                             <asp:Button ID="Button2" runat="server" Text="Copy" OnClick="Button2_Click" /> 
                         </FormTemplate> 
                       </EditFormSettings> 

CS:
 
   protected void Button2_Click(object sender, EventArgs e) 
    { 
        Button btn = (Button)sender; 
        GridEditFormItem editform = (GridEditFormItem)btn.NamingContainer; 
        TextBox txtbx1 = (TextBox)editform.FindControl("TextBox1"); 
        TextBox txtbx2 = (TextBox)editform.FindControl("TextBox2"); 
        txtbx2.Text = txtbx1.Text;  
    } 


If this is not your requirement I would suggest you to send your aspx code and explain a bit more on the desired scenario.

- Princy
0
Durga
Top achievements
Rank 1
answered on 16 Sep 2009, 11:55 AM
Hi Princy,

my problem is:
Ex: i've 10 lines in radgrid. i just want to copy data from 3rd row column(data displayed in label) to 4th row column(4th row is in edit mode and is RadDateTimePicker control).

I am trying to copy data from label to RadDateTimePicker control when cursor focus on edited column control, copy functionality i need to do this by short cut keys(like Ctrl +K) at client side.

Please find the below code for reference.

                    <telerik:GridTemplateColumn SortExpression="SCHEDULE_SHIP_DATE" HeaderText="Schedule Ship Date"
                        HeaderButtonType="TextButton" DataField="SCHEDULE_SHIP_DATE" UniqueName="SCHEDULE_SHIP_DATE">
                        <HeaderStyle Wrap="true" Width="160px" />
                        <ItemStyle Wrap="true" Width="160px" />
                        <ItemTemplate>
                            <asp:Label ID="lblSCHEDULESHIPDATE" runat="server"><%#DataBinder.Eval(Container.DataItem, "SCHEDULE_SHIP_DATE")%></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadDateTimePicker ID="dtSSDateFrom" runat="server" Width="160px" DbSelectedDate='<%# Bind("SCHEDULE_SHIP_DATE") %>'>
                                <Calendar ID="Calendar2" runat="server" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                                    ViewSelectorText="x" FastNavigationStep="12">
                                </Calendar>
                                <DatePopupButton HoverImageUrl="" ImageUrl="" />
                                <TimePopupButton Visible="false" />
                                <DateInput ID="DateInput4" runat="server" Width="170px" DisplayDateFormat="dd-MMM-yyyy HH:mm:ss"
                                    DateFormat="dd-MMM-yyyy HH:mm:ss">
                                </DateInput>
                                <TimeView ID="TimeView1" CssClass="hideTimeView" runat="server">
                                </TimeView>
                            </telerik:RadDateTimePicker>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>


Thanks
Durga
Tags
General Discussions
Asked by
Durga
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Durga
Top achievements
Rank 1
Share this question
or