Sunday, March 11, 2012

choose default value from DropDownList and SqlDataSource

Hello everyone

I'm really new to Data Presentation Controls and I already hate them couse I think they are way too complicated. Becouse of that i have already met wall many times. My last one sounds like this.

I'm triing to put a default value from, lets say SqlDataSource1 in a DropDownList that is created by SqlDataSource2. I know how to get value from SqlDataSource1 but I don't know how to use exactly that value as my default value in DropDownList.

Two more question.

1. Is it possible to have two different select statements in a SqlDataSource?

2. A SqlDataSource may contain an insert statement, select statement, update and delete. If I bind this SqlDataSource to a control how can I specify which of those statements will be used?

Thanks in advance

There are tutorials that cover all these topics in detail.

You bind the value to the dropdownlist's selectedvalue property.

1) Yes, but I don't recommend it.

2) By the command that is clicked within the presentation data control (Formview, detailview, gridview, etc).

I highly suggest you start with the tutorials. From those you learn the basics of how the data controls work. After you've mastered the data controls (Which really only takes an hour to learn the basics, and after a few days you've master them), then you can use them, or not. You always have the option of handling everything yourself. Do your own data retrieval, populate your controls, etc.

No comments:

Post a Comment