|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
FormView - initial templateHi;
I call a page that has a FormView from 3 different buttons - view, edit, and create. So I need to set the initial template when the page is called. Is there a way to do this in the url for the page? Or if I have to do it in it's code- behind, when/how? Hi Dave,
As for the FormView, it has a "DefaultMode" property which can help us specify the Mode/Template the FormView is about to display: #FormView.DefaultMode Property http://msdn2.microsoft.com/en-US/library/system.web.ui.webcontrols.formview. defaultmode(VS.80).aspx and for your scenario, you want to set the Mode according to a querystring parameter on the page, I think we need to check the querystring value and modify the FormView's DefaultMode property in the page's certain event. IMO the "Page_Load" event should be the proper one: e.g: ========================= protected void Page_Load(object sender, EventArgs e) { string mode = Request.QueryString["mode"]; if (mode == "edit") { FormView1.DefaultMode = FormViewMode.Insert; ............................... ================================== Hope this helps. Regards, Steven Cheng Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
DataMappingType in the DataSet Designer
UserControls and Collections Property I do I remove the style attribute from Image controls? HyperLinkField and FindControl Problem in designing layout of website UserControl Gridview Pager Modes Gridview can't format a date Confirm delete in GridView - the easy way Eval in an OnClick? |
|||||||||||||||||||||||