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

Selected value is "" on PageLoad

4 Answers 75 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Leszek
Top achievements
Rank 1
Leszek asked on 24 Sep 2010, 12:25 PM
Hello,
I have selected value = "" on page load i first time page is loaded.
I've read that it is when

 

EnableLoadOnDemand="true"

 


but I've set this parameter to false
Regards.
Leszek

4 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 24 Sep 2010, 02:37 PM
Can you show us what your RadComboBox declaration looks like?
0
Leszek
Top achievements
Rank 1
answered on 30 Sep 2010, 05:41 PM
sorry for delay. I was on the trip.

 

 

 

<telerik:RadComboBox ID="RadCBProducts" Runat="server" AutoPostBack="true"
                    DataSourceID="LinqDSProducts" DataTextField="ProductName" 
                    DataValueField="IdProduct" Skin="Sunset" EnableLoadOnDemand="false">
                </telerik:RadComboBox>

 

 

 

protected void Page_Load(object sender, EventArgs e)
   {
       LinqDSPrices.Where = "Idproduct==" + RadCBProducts.SelectedValue;// this value is "" 
       RadGrid1.DataBind();
       RadGrid1.Rebind();
   }
thanks
Leszek

 

 

 

0
Accepted
Cori
Top achievements
Rank 2
answered on 30 Sep 2010, 07:37 PM
Hello Leszek,

Change your code to this:

RadCBProducts.DataBind();
LinqDSPrices.Where = "Idproduct==" + RadCBProducts.SelectedValue;// this value is "" 
RadGrid1.DataBind(); 
RadGrid1.Rebind();

You need to bind the RadComboBox when accessing it in the Page_Load event because it has not be data bound yet. Thus, the reason why SelectedValue is blank.

I hope that helps.
0
Leszek
Top achievements
Rank 1
answered on 30 Sep 2010, 08:03 PM
it is working now.
Thanks.
Leszek
Tags
ComboBox
Asked by
Leszek
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Leszek
Top achievements
Rank 1
Share this question
or