How to Add a Row in WebForm?

V

VictorReinhart

Hi,
I need to add a row in a WebForm, using VS 2005 and C sharp, using a
SQLDataSource.

If the table or SQLDataSource is empty, and you use a DetailsView
Control to let the user add a new row, the "New" hyperlink is
invisible. Therefore, the user can't add a row. So, what can I do?

Thank you

VictorReinhart
 
D

Dave Hagerich

I dont know if this will help since i dont have any experience with the
DetailsView control. In a DataGrid/DataSet/DataView scenario when the page
loads I check if the DataSet is empty and if it is I use
DataTable.Rows.Add() and DataTable.NewRow() to automatically add a blank
entry and then Set DataGrid.EditItemIndex = 0 to start editing the first
row.

Hope that helps,
Dave
 
V

VictorReinhart

The solution for a FormView is:

FormView1.ChangeMode(FormViewMode.Insert);

For a DetailsView, it is probably:

DetailsView1.ChangeMode(DetailsViewMode.Insert);

Now, if only this could be done for a GridView!
 

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