detailsview - asp.net: How to better load Details view fields programmatically instead of copy/paste -


I have the following code for each lookup table: I have been copying / pasting for each drop down list control till now I am But I think there is a better way to do this. I will be able to add database related related values ​​to DataTextField, DataValueField, control names in the stored proc, etc. Of course I would like to manually see table-like configuration on the database side, and specify other changes. But on ASPX pages or cesiz page, a better way should be copy / paste.

  & lt; / Asp: TemplateField & gt; & Lt; Asp: TemplateField header text = "your breed" & gt;  

'>' id = "lblEthnicity">

Please tell me ... thank you

To run content in the drop down control from the database, you can tie them according to your architecture using several different datasource.

A simple example (change list box in dropdown list):

  & asp: SqlDataSource id = "SqlDataSource1" runat = "server" DataSourceMode = "DataReader" connection string = "& Lt;% $ ConnectionStrings: MyNorthwind% & gt;" SelectCommand = "Select Last Name from Employee" & gt; & Lt; / ASP: SQLDataSource & gt; & Lt; Asp: ListBox id = "ListBox1" runat = "server" datatfstilled = "lastname" datasource id = "SqlDataSource1" & gt; & Lt; / ASP: ListBox & gt;  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -