1.) To "pre-filter" the data from a large table i do this in the
WebDropDown1_ItemsRequested - Event:
this.SqlDataSource1.SelectCommand = string.Format("SELECT IDX,PARAMETER FROM MASTER.K_PARAMETER WHERE PARAMETER LIKE '{0}%'", e.Value.ToString().ToUpper()); this.WebDropDown1.DataBind();so far so good, it works
2.) I've selected a value in the WebDropDown
3.) I fire a WebImageButton1_Click ... Event this.WebTextEdit1.Text = this.WebDropDown1.SelectedItem.Text;4.) Error: SelectedItem.Text is null
kind regards
Hello Andreas,
Thanks for your feedback. I have attached a WebSite project where I have a WebDropDown and WebTextEdit, and select and item, then click the "Set Text" button which does a postback, and the selectedItem.Text is correcty set in the WebTextEdit input box.
Maybe you have EnableMultipleSelection=true ? In that case SelectedItem will always be null, and you will need to refer to the SelectedItems collection property (if only one item is selected, your item will be in WebDropDown1.SelectedItems[0], and will be the same thing as WebDropDown1.SelectedItem).
I hope this helps.
Regards,
Angel
Thanks for your answer.
I set it to SelectItems[0].Text and get now an ArgumentOutOfRange-Exception.
I've send you a PDF with screenshots an the code.
Hi Andreas,
I am attaching a modified sample which uses the same properties and server-side filtering as in your example, and it works fine. If you can send me (attach) some WebSite sample that demonstrates this issue, i will take a look.
Also you can try removing the ValueChanged postback flag declaration, because it is not needed - when there is server-side filtering, an automatic filtering postback will be made and the value changed event on the server will be called anyway. (I didn't remove this in my sample and it works fine).
Thanks for the feedback,
Hi Angel,
sorry: further the same exceptions.
Btw: could it be a framework (3.5SP1) or browser (IE 7.0.5730.13) problem?
When i'm using the webCombo with the property EnableXLMHttp an a DataSourceID, i cant access to the selected cells (Event
WebCombo1_SelectedRowChanged
e.Row.Cells[0].Text...
After switching to the following kind of databinding:
string
sql = string.Format("SELECT IDX,PARAMETER FROM MASTER.K_PARAMETER WHERE PARAMETER LIKE '{0}%'", this.WebCombo1.DisplayValue.ToUpper());
da.Fill(ds,
"VST01");
It works....
I think it is not related to the browser or the .NET framework (I have also tested with IE7 and 35SP1 btw) . It could be related to the databinding, yes. In general the WebCombo control is very different from the WebDropDown.
How do you select the item from the dropdown - by clicking on it with the mouse I suppose?
Thanks,
I am facing the error while using WebDropDown.
There is a situation where i face this error against the following syntax.
WebDropDown.SelectedItem.Text = row["Name"].ToString();
I am using this code while trying to update record in database. On open function i use the above piece of code. I have saved the text of SelectedItem in database not value and my requirement is text not value.
Now i have to select the item from webdropdown for matching text.
EnableMultipleSelection is set to false.
I have not saved the SelectedValue in the database.
Kindly tell me how to select the item in webdropdown from text not value.
Regards
Sheeraz