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

TextBox and Radcombobox problem

4 Answers 59 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Dilip
Top achievements
Rank 1
Dilip asked on 22 Oct 2008, 05:08 AM
Hi,
   I have a textbox and radcombobox control on a page. The textbox is for zip codes and the radcombo should autocomplete the stores in a zip as i type in the combobox. When i type in some text in combobox it does not seem to take the text I passed in textbox control initially. But if i comeback and change the text in zip textbox (basically enter the same text again) it seems to populate the combobox as expected.  Not sure if I a missing anything. Can someone help me with this please.


Thanks
Dilip

4 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 22 Oct 2008, 05:29 AM
Hello Dilip,

The provided information is not enough to reproduce the problem locally. Could you please paste your code here or ideally open a support ticket and send us sample running project to test it locally?

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dilip
Top achievements
Rank 1
answered on 22 Oct 2008, 05:34 AM

 

Here is my aspx code for this part.

<
tr>

 

 

<td style="width: 40%; height: 26px;">

 

 

<div class="pagecontentalt">Zip</div></td>

 

 

<td style=" height: 26px">

 

 

<asp:TextBox ID="txtZip" runat="server"></asp:TextBox></td>

 

 

</tr>

 

 

<tr>

 

 

<td style="width: 40%">

 

 

<div class="pagecontentalt">Stores</div></td>

 

 

<td>

 

 

<telerik1:RadComboBox ID="rdComboSCT" runat="server"

 

 

AllowCustomText="True" ShowToggleImage="False"

 

 

EnableLoadOnDemand="True"

 

 

OnItemsRequested="rdComboSCT_ItemsRequested"

 

 

Skin="Web20"

 

 

AutoPostBack="True" onselectedindexchanged="rdComboSCT_SelectedIndexChanged"

 

 

ShowWhileLoading="True">

 

 

 

</telerik1:RadComboBox></td>

 

 

</tr>



Hers is part of  my code behind. 


 

 

protected void rdComboSCT_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)

 

{

 

RadComboBox comboBox = (RadComboBox)sender;

 

BindDataToSCTComboBox(e.Text, comboBox);

}

 

 

protected void BindDataToSCTComboBox(string text, RadComboBox comboBox)

 

{

 

DataTable dt = new DataTable();

 

dt =

new ProjDataHandler().GetItemsLikeForZipAsDataTable(text, txtZip.Text.Trim());

 

 

comboBox.Items.Clear();

 

foreach (DataRow row in dt.Rows)

 

{

 

RadComboBoxItem item = new RadComboBoxItem();

 

item.Text = row[

"Name"].ToString();

 

item.Value = row[

"Id"].ToString();

 

comboBox.Items.Add(item);

}

}

0
Rosi
Telerik team
answered on 22 Oct 2008, 05:49 AM
Hi Dilip,

Thank you for the provided cove.

The reason for the problem is that ItemsRequested event is a result of a callback. And when it is executed the ViewState is not loaded yet.

I suggest you solve the problem by using the Context property of RadComboBox. Please follow the article for more details : Passing Context Information to the Server

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dilip
Top achievements
Rank 1
answered on 22 Oct 2008, 05:55 AM
Thanks so much Rosi for help. I will try it out.
Tags
ComboBox
Asked by
Dilip
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Dilip
Top achievements
Rank 1
Share this question
or