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

RadTextBox Populating Values

1 Answer 101 Views
Input
This is a migrated thread and some comments may be shown as answers.
Sudhakar
Top achievements
Rank 1
Sudhakar asked on 22 Oct 2014, 11:43 AM
Hi Team,

I am having three text boxes in the form.
I need to populate the other two text box values based on the value in the first text box value.
These values are coming from database.
ASPX FILE:

  <tr class="FormContainer">
                    <td style="white-space: nowrap;">
                        Terminal ID:
                    </td>
                    <td>
                        <telerik:RadTextBox ID="txtTerminalId" runat="server" >
                             
                        </telerik:RadTextBox>
                        <asp:RequiredFieldValidator ID="txtTerminalIdValidator" runat="server" Display="Dynamic"
                            ControlToValidate="txtTerminalId" ErrorMessage="TerminalId can not be empty!"></asp:RequiredFieldValidator>
                       
                    </td>
                </tr>                <tr class="FormContainer">
                    <td style="white-space: nowrap;">
                        Terminal Name:
                    </td>
                    <td>
                        <telerik:RadTextBox ID="txtTerminalName" runat="server"></telerik:RadTextBox>
                       
                    </td>
                </tr>                <tr class="FormContainer">
                    <td style="white-space: nowrap;">
                        Terminal Address:
                    </td>
                    <td>
                        <telerik:RadTextBox ID="txtTerminalAddress" runat="server"></telerik:RadTextBox>
                       
                    </td>
                </tr>
When i Type Terminal Id in the textbox,Terminal name and terminal address needs to populate automatically.
These values are coming from the database.

protected void plantIdChanged(object sender, EventArgs e)
    {
       
        Int64 plant_id = Convert.ToInt64(txtTerminalId.Text);        var depots = loadingManager.GetLoadingSite(plant_id).FirstOrDefault(x => x.Plant_ID == plant_id);
        if (depots != null)
        {
            txtTerminalName.Text = depots.PlantText;
            txtTerminalAddress.Text = depots.Street + " " + depots.Zipcode;
        }
       
    }
   
plantIdChanged m
ethod is used for get terminal name and terminal address from database based on the terminalid(plant_id).
Need to implement it in Onblur event of the text box.

Can any one please help,how to implement this.


1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 27 Oct 2014, 08:30 AM
Hello Sudhakar,

In order to implement the described functionality you can handle the OnTextChanged event for RadTextBox. Note that in order for the event to be triggered you should set the AutoPostBack property to true. The markup for the first RadTextBox control would look similar to the following:

<telerik:RadTextBox ID="txtTerminalId" runat="server" OnTextChanged="plantIdChanged" AutoPostBack="true"></telerik:RadTextBox>

Try this approach and you should be able to implement the functionality you are looking for.

Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Input
Asked by
Sudhakar
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or