mugsey
asked on
How to switch between view and edit mode in an asp.net 2.0 web form
Currently I have a web form that loads a lot of text boxes with values from asp.net membership
EG
this.txtEmail.Text = _msu.Email;
What is the best approach for making this web form editable. ie, load the form then switch the text boxes between edit and view mode
EG
this.txtEmail.Text = _msu.Email;
What is the best approach for making this web form editable. ie, load the form then switch the text boxes between edit and view mode
ASKER
Can I use this without the object data source?
yes....think of the formview just like a gridview that shows only one record.
and like the gridview, you can have itemtemplate and edititemtemplate section...
you can place a label in itemtemplate and a textbox in edititemtemplate...and to set the data without using a datasource, you can use "findcontrol" (just like gridview)... to get to the label/textbox to set the values
and like the gridview, you can have itemtemplate and edititemtemplate section...
you can place a label in itemtemplate and a textbox in edititemtemplate...and to set the data without using a datasource, you can use "findcontrol" (just like gridview)... to get to the label/textbox to set the values
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Has anyone got an example with formview WITHOUT an object data source?? :-)
...you have the membership object...which I think you can use as the datasource...
ASKER
Well its because I am using a customised membership provider and it causes me pain if I try and use the object data source
Use a DetailsView instead. Are you connecting to Active Directory (LDAP)? If not, why can't you just use SqlDataSource?
to access textboxes
TextBox txtEmail = (TextBox)DetailsView1.Find Control("t xtemmail") ;
to access textboxes
TextBox txtEmail = (TextBox)DetailsView1.Find
http://msdn2.microsoft.com/en-us/library/fyf1dk77.aspx
google "asp.net formview" for more