开发者

VB.NET Dynamic creation of Details View with a web panel

开发者 https://www.devze.com 2023-01-22 20:04 出处:网络
Every time i enter set of values like Group Name,Group Abbreviation,URL in the text boxesand click the save button automatically its saves in the database and for each set of values a new details view

Every time i enter set of values like Group Name,Group Abbreviation,URL in the text boxes and click the save button automatically its saves in the database and for each set of values a new details view has to be generate开发者_StackOverflow中文版d dynamically with a web panel and the header of the web panel should have the value of Group Name. Example:

 Group1

Name Group1

Abbreviation G1

URL http://stackoverflow.com

  Group2

Name Group2

Abbreviation G2

URL http://stackoverflow.com

A new details view with web panel like the above has to be generated every time the save button is clicked.

Thanks in Advance.


This solution assumes each group is a single database record.

  1. Use a datasource which pulls all of the IDs for the groups that should be displayed on the page.
  2. Create a repeater control and set its datasource to the datasource created in step 1
  3. Add a hidden input field to the content template for the repeater control. Bind it's value to the group's id.
  4. Add a details view control to the repeater control template.
  5. Add a datasource to the repeater control template that returns a group record filtered on the hidden input control.

When you submit a new group, make sure to rebind the data on the repeater control created in step 2.

Alternatively, it would be much easier to just use a listview if possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消