on 08-03-2005 9:41 AM
Hi Dear,
I have got a problem viewing the Items of a filled DropDownByKey Control.
I want to fill the Control dynamically by setting the .DataSource Property. The type of the DataSource is a DataView.
The following lines
....
....
dv=mySpecialDataView();
ddbkObject.DataSource=dv;
ddbkObject.DataBind();
....
do fill the Control, but no item in the Control is displayed. Whether the control is filled up or not, i do check with debugging. The .Rows.Count property of the DataSource gives me the right result.
Do I miss some properties to be set?
On the other Hand i have got a ASP.NET DropDownList Control, which is assigned the same DataSource. The ASP.NET Control shows me all the items filled into the DropDownList.
Where is the problem?
Hi Ofer,
thanks for your reply.
I do know the documents. But I am missing some sample code. Do you can help me out?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again,
Ok, here you go (this assumes myDataSource has "key" and "text" columns):
private void Page_Load(object sender, System.EventArgs e)
{
DropDownByKey1.DataSource = myDataSource;
DropDownByKey1.DataBind();
}
// Add handler to the ItemCreated event of the
//DropDownByKey and bind the data to the field
private void DropDownByKey1_ItemCreated(object sender, SAP.Web.UI.Controls.AbstractDropDown.ItemEventArgs e)
{
// Binding the data to the fields
e.Item.Key = DataBinder.GetPropertyValue(e.Item.DataSourceRow.DataItem, "key", null);
e.Item.Text = DataBinder.GetPropertyValue(e.Item.DataSourceRow.DataItem, "text", null);
}
Regards,
Ofer
-
Have you filled the PDK survey yet? You can win an MP3 player!!!
http://feedback.sap.com/efs/vote?campaign=39c7899ecca40a6709a638bd0388ac8b&org=332
Hi,
If you want to understand more about the NetWeaver control (and why what you did doesn't work) I recommend you first read https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/sap netweaver .net controls vs. asp.net controls.pdf
In your case you should concentrate at the "Complex DataBinding" Section.... but you can read it all.
Reading this you will learn that the Netweaver controls were "meant" to be bound in design time (in the sense that it's the easiest and most powerful way to do it). But since this isn't your case, the solution is to use the "ItemDataBound" Event to explicitly say which property binds to which... (since the ItemTemplate isn't bound).
Hope that helped,
Ofer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.