Mater-Detail

F

Fabiano

Please,

i need to create a web page that show data from an ORDER table. But when the
user browses over the records, dropdownlist, radiobuttons and others bounded
controls must refresh they data, such as Credit Card, Supplyer, and on.

How can i do this, using programatically Datasets? Everything automatic.

When browse refresh, when ADD button is clicked every control must be
cleared and accept data entry.

Tks a lot.

Fabiano
 
S

Steven Cheng[MSFT]

Hi Fabinao,

From your description, you'd like to build a master detailed databind
asp.net webform page. In the page you use a DataGrid to display the main
records and when one recored in the datagrid is selected, those textboxes
or dropdownlists or .. will be filled with the certain selected record's
detailed data. And when we want to add record, those fields will be cleared
,yes?

As for this problem, here are my suggestions:
1. Retrieved the master-detailed datas from the databse when the web form
page is first time loaded(using DataSet). Then store them in some place for
later use, maybe in Session or ViewState.

2. Then bind the master table's records with the DataGrid control, note you
need to provide a button column in the datagrid which is used to let the
user select a certain row of record. When first time loaded, bind those
textboxes or dropdownlist's value with the first record's detailed value.

3. Then when a certain record's row's button is clicked, in the
serverside's click event(datagrid's itemcommand event) retrieve the certain
selected record's datas and fill them in the textboxes or dropdownlists....

4. If you want to provide insert function, you can add a "Add" button and
in its "click" event, you can use code to clear all the textboxes or other
fields' value and let the user to input new record's value. And then after
user click submit, in the submit button's click event, insert the new
record and update the local dataset.

If you fill it abit too complex, you can view the following turoial in the
ASP.NET Quickstart:

http://samples.gotdotnet.com/quickstart/aspplus/doc/webdataaccess.aspx

http://samples.gotdotnet.com/quickstart/aspplus/doc/webdatalist.aspx

Also, here are some more detailed tech articles on master-detailed
databinding:
#HOW TO: Create a Master/Detail Page with Web Form Controls
http://support.microsoft.com/?id=308485

#Master-Detail DataGrids in ASP.Net...
http://www.dotnetjohn.com/articles/articleid14.aspx

#Creating Master-Detail Listings using ASP.NET controls
http://www.dotnetbips.com/displayarticle.aspx?id=184

#Building DataBound Templated Custom ASP.NET Server Controls
http://msdn.microsoft.com/library/en-us/dnaspp/html/databoundtemplatedcontro
ls.asp?frame=true

Hope also helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
F

Fabiano

Something like this. Your answer helped me a lot. But what i would like to
do is something without a DataGrid.

Something like "a contact page" with lots of textboxes and a dropdownlist.
When user is navigating through it every DDL must show related data from
table.

Something like a lookupcombbox as named at Delphi. Or DDL databinding
allowed at winforms.

tks if u can help me again.

Fabiano
 
S

Steven Cheng[MSFT]

Hi Fabianao,

Thanks for the followup. As for the
==================
Something like "a contact page" with lots of textboxes and a dropdownlist.
When user is navigating through it every DDL must show related data from
table.
And not use DataGrid
===================
you mentioned, do you meand that you're wanting to generate a certain
records navigate page which only show each record's detailed datas and have
some navigate buttons such as
<<First <Previous >Next >>Last ?
Is is like the following layout?
------------------------------------------------------------------
textbox textbox textbox dropdownlist |
textbox textbox textbox dropdownlist | ------ databinding
controls
textbox textbox textbox dropdownlist |

<< < > >>
| ----------navigate buttons
First Previous Next Last |



If so, I think it's just something as I mentioned in the last reply. You
can Retrive all the records when the page first time loaded and store in a
certain place (Session or page's ViewState), otherwise you need to retrieve
them(put in a DataSet) from database everytime the navigate button is
clicked.

Then, when the user click navigator button and the page posted back, you
retieve the certain record's data from the stored DataSet and then replace
all the controls on the page with the new values. All these operations are
common data retrieveing and databinding ops, you may view the weblinks in
my last reply for detailed reference.
Also, if you feel anything unclear, please feel free to post here. thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top