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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Starting a FormView in Insert Mode

Status
Not open for further replies.

MdotButler

Programmer
Jan 18, 2006
104
US
I have a form that is normally started passing the Primary Key from a find form or related child forms via a button. The form normally starts using the <ItemTemplate> allowing a user to select an Edit, Delete or New link at the bottom.

I was wondering how I can start the form in insert or New mode directly?

TIA
Mark
 
Is this a windows form or an ASP.NET page? Also, what control are you using?
 
This is an ASP.NET 2.0 "FormView" data control "<ASP:FormView ....>".
 
That works great except that after the "Insert" link is pressed the form again enters into InsertMode. Following is what I placed into the "Page_Load" to accomplish the initial issue.
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If (Not IsPostBack) Then
        If Request.QueryString("Edit") = "Add" Then
            FormView1.DefaultMode = FormViewMode.Insert
        End If
    End If
End Sub
Now the question is how to and where to reset the "Default" so after the "Insert" link is pressed the form starts acting normal again.

Again Thanx
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top