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

[Solved] RadTextBox and Asp button

1 Answer 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ricardo Rekowsky
Top achievements
Rank 1
Ricardo Rekowsky asked on 08 Oct 2009, 07:58 PM
Hello!

I was trying to find some references searching the forums and google but I couldn't find anything related... Maybe I don't know exactly how to look up the information.

I'm using VS 2008 with a trial version of Telerik Ajax asp.net and I have two doubts.

I created a RadGrid in Popup mode for inserting the data through a custom template. So far so good. Regular text boxes insert the data correctly.

1. Inside the template I added a couple of RadTextBoxes and added an asp button to search addresses based on the ZIP code informed. When I run the search off the template window it works properly running the button onClick's method, but I can't access the function that inside the aspx.cs file from within the template stating that the textbox id couldn't be found. How can I access this function?

2. In the template I added a RadCombobox in order to read the data from a second table (get it populated properly) but I'd like to bind the selected value with the table's value when I update/insert.
The main table is my Client's table and the referred one is a status table.

The following code is inside the template:
                    <telerik:RadComboBox ID="RadComboBox1" Runat="server"  
                        DataSourceID="SituacaoAlunosDatasource"  
                        DataTextField="sts_titulo"  
                        DataValueField="sts_id"  
                        LoadingMessage="Carregando..." AppendDataBoundItems="true"  
                        SelectedValue='<%# Bind("eixxxx_sts_statusaluno") %>' > 
                    </telerik:RadComboBox> 

The error message says that the field "eixxxx_sts_statusaluno" can't have the property set... This field is related to the main table's field.

Thanks for the help

Ricardo


1 Answer, 1 is accepted

Sort by
0
Johny
Top achievements
Rank 1
answered on 14 Oct 2009, 07:16 AM
Hi Ricardo

To get the radtextbox in the click handler of the button you can use:

protected void Button1_Click(object sender, EventArgs e) 
    { 
        ((sender as Button).NamingContainer.FindControl("RadTextBox1"); 
    } 

When using the Bind method you should ensure that the field you bind to is not ReadOnly.

I have also looked through the site and found that this example might help you:

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/popupeditform/defaultcs.aspx

I hope this helps.
Johny






Tags
Grid
Asked by
Ricardo Rekowsky
Top achievements
Rank 1
Answers by
Johny
Top achievements
Rank 1
Share this question
or