Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best practice in creating an update form web page?

Status
Not open for further replies.

fiat2

Programmer
Nov 26, 2002
104
0
0
US
Using VS2005.
I'm creating this web page that allows an admin to update the count of their products.
The product list is dynamic; certain items may be discontinued at any time.

What I was thinking but is not working so well, is using the Repeater control. Create a Label, asign the label Text to the product and then include a TextBox and assign the ID to the product as well, and repeat this for each product, but I was receiving an error regarding the Label inside of a repeater...Now, I'm thinking of performing this loop during page_load() on the .vb page to programmatically create the labels and textboxes..

Just looking for opinions/advice in the direction I should go.

As always, thanks!
 
A repeater is certainly capable of doing what you need, especially if you need flexibility over the layout. From your description, a GridView may be a more appropiate choice though.


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
A gridView using a TemplateColumn with ItemTemplates may be worth looking into
 
Thanks to all.
I did find that ability with the gridview but I'm thinking that the individual update process would be too time-consuming, i.e, clicking Edit, Modify value, click Update for each record.
There are about 75-100 products at a given time...

I would want them to be able to edit a value in a textbox hit tab, modify next and so on and at the end, update all products with a click of a Submit button.

Thanks again!
 
That's great.
I've been playing around with this control and have not seen that configuration.

So, just to recap:
A GridView will be give me the ability to enter numerical values into a textbox and then peform a One-time update to all records?

Can you please elaborate on how to configure the GridView to achieve this.

Thanks!
 
Have a look at the example here:


In fact, go through some of the other tutorials as well to get a good grasp on the controls you have available to you.


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
I'll review the links provided and post back more info.

Thanks to all.


 
What I usually do is the following. I create a Gridview with Hiddenfields that will contain the ID value of a certain item from the database, then another hiddenfield (the amount depends on the items you wish to edit in that tablerow).

Once the hiddenfields are made you add the textboxes or other controls.

Now when all the controls are added it's time to set the values of those controls I usually do that during the RowDatabound event of said gridview.

Add a button to a page that will handle the save your rows,
in the code behind add a loop that will go trough each row in the gridview and make it compare the hiddenfield values to the values of the corresponding controls if one of them is different you know that you will need to call a function that updates that row.

Please note, a little bit more work is required for this method (setting up the controls and filling them etc) but sofar I haven't noticed anything wrong with this solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top