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

How Find The RadTextBox in Insert Mode,When Onclick Event of Button.

6 Answers 222 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sairam
Top achievements
Rank 1
Sairam asked on 20 May 2013, 11:01 AM
In Rad  grid  ,I have Text Box and Button beside of text Box, When user click the  button, In that situation,I want access the text box,values and reset with some "100". all these in side grid Template column.

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 May 2013, 12:49 PM
Hi,

Please have a look at the following C#.

C#:
protected void RadButton1_Click(object sender, EventArgs e)
{
    foreach (GridDataItem DataItem in RadGrid1.Items)
    {
        RadTextBox text1 = (RadTextBox)DataItem.FindControl("RadTextBox1");
        string val = text1.Text;
        text1.Text = "100";
    }
}

Thanks,
Shinu.
0
Sairam
Top achievements
Rank 1
answered on 20 May 2013, 01:14 PM
 This is the code :It is in rad grid ...

<telerik:GridTemplateColumn Visible="true" DataField="chkNumber" HeaderText="Check Number"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" UniqueName="chkNumber">
                    <ItemTemplate>
                        <%# Eval("chkNumber")%><%--.ToString().PadLeft(4, '0')%>--%>
                    </ItemTemplate>
                    <InsertItemTemplate>
                        <telerik:RadTextBox ID="rdtxtchkNumber1" runat="server" Width="160px" MaxLength="4"
                            onclick="shouldConfirm = true;" Text='<%# Eval("chkNumber") %>'>
                        </telerik:RadTextBox>
                        <telerik:RadButton ID="RbtnReset1" runat="server" Width="40px" AutoPostBack="true"
                            CausesValidation="false" Text="Reset" OnClick="RbtnResetCheckNoinInsert_Click">
                        </telerik:RadButton>
<InsertItemTemplate>
</telerik:GridTemplateColumn >


unfortunately  The sending snippet is not working ...can you please help see the above code.

0
Shinu
Top achievements
Rank 2
answered on 21 May 2013, 07:34 AM
Hi,

Please have a look at the following C# code I tried which works fine at my end.

C#:
protected void RbtnResetCheckNoinInsert_Click(object sender, EventArgs e)
{
    RadButton button1 = (RadButton)sender;
    GridEditFormInsertItem insert = (GridEditFormInsertItem)button1.NamingContainer;
    RadTextBox txt = (RadTextBox)insert.FindControl("rdtxtchkNumber1");
    string value = txt.Text;
    txt.Text = "100";
}

Thanks,
Shinu.
0
Sairam
Top achievements
Rank 1
answered on 21 May 2013, 08:52 AM
Thanks ,for your replay but In that ,I am click on button first one  ask "rad Window"  ,confirmation based on yes ,your click on the rad confirm ,an other rad window is opened for  "taking" the values,In  the window we have rad text box,in rad text box  enter values replace with the already Rad Text Box Value.
0
Kostadin
Telerik team
answered on 23 May 2013, 09:43 AM
Hello Sairam,

I would suggest you to save the TextBox value in a new variable on client side and when the RadWindow is opened to set this value to the TextBox located in the RadWindow.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Sairam
Top achievements
Rank 1
answered on 24 May 2013, 05:59 AM
Thanks Shinu,  Problem is resolved ,based on given information .
Tags
General Discussions
Asked by
Sairam
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sairam
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or