Home All Groups Group Topic Archive Search About
Author
8 Apr 2006 9:03 PM
David Thielen
Hi;

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?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Author
10 Apr 2006 8:25 AM
Steven Cheng[MSFT]
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.)