PC Review


Reply
Thread Tools Rate Thread

asp:Wizard inside of a asp:FormView breaks two-way databinding

 
 
John R. Lewis
Guest
Posts: n/a
 
      5th Jan 2006
I posted this yesterday with a different email address. I am reposting with
my fake-address as given to me by Microsoft so that I can be guraranteed a
response from a support representative. Sorry for the repost.

I'd like to make use of the asp:Wizard control to present a step-by-step
guided experience for my user to fill out a complicated data-entry form.

I'd like to make use of two-way databinding provided by the asp:FormView
control to drasticly reduce the number of lines of code I need to write.

But when I combine those two controls, databinding breaks. Please see the
example below. The database in this example is a simple access database with
a single table My real life example is way to complicated to describe here,
but this simple case reproduces the problem.

If you run through the wizard, clicking Finish causes a record to be
inserted with null values in all the fields. What I don't show here, is if
you strip out the wizard control, everything works fine.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Wizard1_FinishButtonClick(object sender,
WizardNavigationEventArgs e)

{

FormView1.InsertItem(true);

}

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/db1.mdb"

InsertCommand="INSERT INTO [Thing] ([Step1Data], [Step2Data], [Step3Data],
[Step4Data]) VALUES (?, ?, ?, ?)"

SelectCommand="SELECT * FROM [Thing]">

<InsertParameters>

<asp:Parameter Name="Step1Data" Type="String" />

<asp:Parameter Name="Step2Data" Type="String" />

<asp:Parameter Name="Step3Data" Type="String" />

<asp:Parameter Name="Step4Data" Type="String" />

</InsertParameters>

</asp:AccessDataSource>

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="ThingID"

DataSourceID="AccessDataSource1">

<Columns>

<asp:BoundField DataField="ThingID" HeaderText="ThingID"
InsertVisible="False" ReadOnly="True"

SortExpression="ThingID" />

<asp:BoundField DataField="Step1Data" HeaderText="Step1Data"
SortExpression="Step1Data" />

<asp:BoundField DataField="Step2Data" HeaderText="Step2Data"
SortExpression="Step2Data" />

<asp:BoundField DataField="Step3Data" HeaderText="Step3Data"
SortExpression="Step3Data" />

<asp:BoundField DataField="Step4Data" HeaderText="Step4Data"
SortExpression="Step4Data" />

</Columns>

</asp:GridView>

<asp:FormView ID="FormView1" runat="server" DataSourceID="AccessDataSource1"
DataKeyNames="ThingID" DefaultMode="Insert">

<InsertItemTemplate>

<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0"
OnFinishButtonClick="Wizard1_FinishButtonClick">

<WizardSteps>

<asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1">Step1Data:

<asp:TextBox ID="Step1DataTextBox" runat="server" Text='<%#
Bind("Step1Data") %>'></asp:TextBox><br />

</asp:WizardStep>

<asp:WizardStep ID="WizardStep2" runat="server" Title="Step 2">Step2Data:

<asp:TextBox ID="Step2DataTextBox" runat="server" Text='<%#
Bind("Step2Data") %>'></asp:TextBox><br />

</asp:WizardStep>

<asp:WizardStep ID="WizardStep3" runat="server" Title="Step 3">Step3Data:

<asp:TextBox ID="Step3DataTextBox" runat="server" Text='<%#
Bind("Step3Data") %>'></asp:TextBox><br />

</asp:WizardStep>

<asp:WizardStep ID="WizardStep4" runat="server" Title="Step 4">Step4Data:

<asp:TextBox ID="Step4DataTextBox" runat="server" Text='<%#
Bind("Step4Data") %>'></asp:TextBox><br />

</asp:WizardStep>

</WizardSteps>

</asp:Wizard>

&nbsp;&nbsp;

</InsertItemTemplate>

</asp:FormView>

</div>

</form>

</body>

</html>




 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      6th Jan 2006
Hi John,

Welcome to ASPNET newsgroup.
As for the using FormView control together with Wizard control to perform
data inserting problem , based on my understanding, it is likely due to the
Wizard control itself is a Naming Container which cause its child control
can not be recognized by the FormView's template(only direct nested Control
will be recognized....)...

So far I'm thinking use Control Parameter to map sub control and the insert
parameters, but seems it'll be also a bit hard. Anyway, I'll perform some
further test to see whether there is any other means to workaround this and
will update you soon.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)








--------------------
| From: "John R. Lewis" <(E-Mail Removed)>
| Subject: asp:Wizard inside of a asp:FormView breaks two-way databinding
| Date: Thu, 5 Jan 2006 10:48:11 -0800
| Lines: 160
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <(E-Mail Removed)>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-19-165-1.hsd1.wa.comcast.net 24.19.165.1
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:368831
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I posted this yesterday with a different email address. I am reposting
with
| my fake-address as given to me by Microsoft so that I can be guraranteed
a
| response from a support representative. Sorry for the repost.
|
| I'd like to make use of the asp:Wizard control to present a step-by-step
| guided experience for my user to fill out a complicated data-entry form.
|
| I'd like to make use of two-way databinding provided by the asp:FormView
| control to drasticly reduce the number of lines of code I need to write.
|
| But when I combine those two controls, databinding breaks. Please see the
| example below. The database in this example is a simple access database
with
| a single table My real life example is way to complicated to describe
here,
| but this simple case reproduces the problem.
|
| If you run through the wizard, clicking Finish causes a record to be
| inserted with null values in all the fields. What I don't show here, is
if
| you strip out the wizard control, everything works fine.
|
| <%@ Page Language="C#" %>
|
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| <script runat="server">
|
| protected void Wizard1_FinishButtonClick(object sender,
| WizardNavigationEventArgs e)
|
| {
|
| FormView1.InsertItem(true);
|
| }
|
| </script>
|
| <html xmlns="http://www.w3.org/1999/xhtml" >
|
| <head runat="server">
|
| <title>Untitled Page</title>
|
| </head>
|
| <body>
|
| <form id="form1" runat="server">
|
| <div>
|
| <asp:AccessDataSource ID="AccessDataSource1" runat="server"
| DataFile="~/App_Data/db1.mdb"
|
| InsertCommand="INSERT INTO [Thing] ([Step1Data], [Step2Data],
[Step3Data],
| [Step4Data]) VALUES (?, ?, ?, ?)"
|
| SelectCommand="SELECT * FROM [Thing]">
|
| <InsertParameters>
|
| <asp:Parameter Name="Step1Data" Type="String" />
|
| <asp:Parameter Name="Step2Data" Type="String" />
|
| <asp:Parameter Name="Step3Data" Type="String" />
|
| <asp:Parameter Name="Step4Data" Type="String" />
|
| </InsertParameters>
|
| </asp:AccessDataSource>
|
| <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
| DataKeyNames="ThingID"
|
| DataSourceID="AccessDataSource1">
|
| <Columns>
|
| <asp:BoundField DataField="ThingID" HeaderText="ThingID"
| InsertVisible="False" ReadOnly="True"
|
| SortExpression="ThingID" />
|
| <asp:BoundField DataField="Step1Data" HeaderText="Step1Data"
| SortExpression="Step1Data" />
|
| <asp:BoundField DataField="Step2Data" HeaderText="Step2Data"
| SortExpression="Step2Data" />
|
| <asp:BoundField DataField="Step3Data" HeaderText="Step3Data"
| SortExpression="Step3Data" />
|
| <asp:BoundField DataField="Step4Data" HeaderText="Step4Data"
| SortExpression="Step4Data" />
|
| </Columns>
|
| </asp:GridView>
|
| <asp:FormView ID="FormView1" runat="server"
DataSourceID="AccessDataSource1"
| DataKeyNames="ThingID" DefaultMode="Insert">
|
| <InsertItemTemplate>
|
| <asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0"
| OnFinishButtonClick="Wizard1_FinishButtonClick">
|
| <WizardSteps>
|
| <asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1">Step1Data:
|
| <asp:TextBox ID="Step1DataTextBox" runat="server" Text='<%#
| Bind("Step1Data") %>'></asp:TextBox><br />
|
| </asp:WizardStep>
|
| <asp:WizardStep ID="WizardStep2" runat="server" Title="Step 2">Step2Data:
|
| <asp:TextBox ID="Step2DataTextBox" runat="server" Text='<%#
| Bind("Step2Data") %>'></asp:TextBox><br />
|
| </asp:WizardStep>
|
| <asp:WizardStep ID="WizardStep3" runat="server" Title="Step 3">Step3Data:
|
| <asp:TextBox ID="Step3DataTextBox" runat="server" Text='<%#
| Bind("Step3Data") %>'></asp:TextBox><br />
|
| </asp:WizardStep>
|
| <asp:WizardStep ID="WizardStep4" runat="server" Title="Step 4">Step4Data:
|
| <asp:TextBox ID="Step4DataTextBox" runat="server" Text='<%#
| Bind("Step4Data") %>'></asp:TextBox><br />
|
| </asp:WizardStep>
|
| </WizardSteps>
|
| </asp:Wizard>
|
| &nbsp;&nbsp;
|
| </InsertItemTemplate>
|
| </asp:FormView>
|
| </div>
|
| </form>
|
| </body>
|
| </html>
|
|
|
|
|

 
Reply With Quote
 
Douglas J. Badin
Guest
Posts: n/a
 
      25th Jan 2006
Hi Steven,

What is the status on this?

I saw this was an issue in Beta 2, Bug ID: FDBK27772,
http://lab.msdn.microsoft.com/Produc...1-7e93b1d52077,
inside naming containers (multiview, panel, etc) and fixed in a later build.

If you suspect this to be the case for the wizard, why didn't FDBK27772 fix
it also?

Thanks,

Doug
"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi John,
>
> Welcome to ASPNET newsgroup.
> As for the using FormView control together with Wizard control to perform
> data inserting problem , based on my understanding, it is likely due to
> the
> Wizard control itself is a Naming Container which cause its child control
> can not be recognized by the FormView's template(only direct nested
> Control
> will be recognized....)...
>
> So far I'm thinking use Control Parameter to map sub control and the
> insert
> parameters, but seems it'll be also a bit hard. Anyway, I'll perform some
> further test to see whether there is any other means to workaround this
> and
> will update you soon.
>
> Thanks,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
>
>
>
>
>
>
> --------------------
> | From: "John R. Lewis" <(E-Mail Removed)>
> | Subject: asp:Wizard inside of a asp:FormView breaks two-way databinding
> | Date: Thu, 5 Jan 2006 10:48:11 -0800
> | Lines: 160
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
> | X-RFC2646: Format=Flowed; Original
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
> | Message-ID: <(E-Mail Removed)>
> | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | NNTP-Posting-Host: c-24-19-165-1.hsd1.wa.comcast.net 24.19.165.1
> | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
> | Xref: TK2MSFTNGXA02.phx.gbl
> microsoft.public.dotnet.framework.aspnet:368831
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> |
> | I posted this yesterday with a different email address. I am reposting
> with
> | my fake-address as given to me by Microsoft so that I can be guraranteed
> a
> | response from a support representative. Sorry for the repost.
> |
> | I'd like to make use of the asp:Wizard control to present a step-by-step
> | guided experience for my user to fill out a complicated data-entry form.
> |
> | I'd like to make use of two-way databinding provided by the asp:FormView
> | control to drasticly reduce the number of lines of code I need to write.
> |
> | But when I combine those two controls, databinding breaks. Please see
> the
> | example below. The database in this example is a simple access database
> with
> | a single table My real life example is way to complicated to describe
> here,
> | but this simple case reproduces the problem.
> |
> | If you run through the wizard, clicking Finish causes a record to be
> | inserted with null values in all the fields. What I don't show here, is
> if
> | you strip out the wizard control, everything works fine.
> |
> | <%@ Page Language="C#" %>
> |
> | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> |
> | <script runat="server">
> |
> | protected void Wizard1_FinishButtonClick(object sender,
> | WizardNavigationEventArgs e)
> |
> | {
> |
> | FormView1.InsertItem(true);
> |
> | }
> |
> | </script>
> |
> | <html xmlns="http://www.w3.org/1999/xhtml" >
> |
> | <head runat="server">
> |
> | <title>Untitled Page</title>
> |
> | </head>
> |
> | <body>
> |
> | <form id="form1" runat="server">
> |
> | <div>
> |
> | <asp:AccessDataSource ID="AccessDataSource1" runat="server"
> | DataFile="~/App_Data/db1.mdb"
> |
> | InsertCommand="INSERT INTO [Thing] ([Step1Data], [Step2Data],
> [Step3Data],
> | [Step4Data]) VALUES (?, ?, ?, ?)"
> |
> | SelectCommand="SELECT * FROM [Thing]">
> |
> | <InsertParameters>
> |
> | <asp:Parameter Name="Step1Data" Type="String" />
> |
> | <asp:Parameter Name="Step2Data" Type="String" />
> |
> | <asp:Parameter Name="Step3Data" Type="String" />
> |
> | <asp:Parameter Name="Step4Data" Type="String" />
> |
> | </InsertParameters>
> |
> | </asp:AccessDataSource>
> |
> | <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
> | DataKeyNames="ThingID"
> |
> | DataSourceID="AccessDataSource1">
> |
> | <Columns>
> |
> | <asp:BoundField DataField="ThingID" HeaderText="ThingID"
> | InsertVisible="False" ReadOnly="True"
> |
> | SortExpression="ThingID" />
> |
> | <asp:BoundField DataField="Step1Data" HeaderText="Step1Data"
> | SortExpression="Step1Data" />
> |
> | <asp:BoundField DataField="Step2Data" HeaderText="Step2Data"
> | SortExpression="Step2Data" />
> |
> | <asp:BoundField DataField="Step3Data" HeaderText="Step3Data"
> | SortExpression="Step3Data" />
> |
> | <asp:BoundField DataField="Step4Data" HeaderText="Step4Data"
> | SortExpression="Step4Data" />
> |
> | </Columns>
> |
> | </asp:GridView>
> |
> | <asp:FormView ID="FormView1" runat="server"
> DataSourceID="AccessDataSource1"
> | DataKeyNames="ThingID" DefaultMode="Insert">
> |
> | <InsertItemTemplate>
> |
> | <asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0"
> | OnFinishButtonClick="Wizard1_FinishButtonClick">
> |
> | <WizardSteps>
> |
> | <asp:WizardStep ID="WizardStep1" runat="server" Title="Step
> 1">Step1Data:
> |
> | <asp:TextBox ID="Step1DataTextBox" runat="server" Text='<%#
> | Bind("Step1Data") %>'></asp:TextBox><br />
> |
> | </asp:WizardStep>
> |
> | <asp:WizardStep ID="WizardStep2" runat="server" Title="Step
> 2">Step2Data:
> |
> | <asp:TextBox ID="Step2DataTextBox" runat="server" Text='<%#
> | Bind("Step2Data") %>'></asp:TextBox><br />
> |
> | </asp:WizardStep>
> |
> | <asp:WizardStep ID="WizardStep3" runat="server" Title="Step
> 3">Step3Data:
> |
> | <asp:TextBox ID="Step3DataTextBox" runat="server" Text='<%#
> | Bind("Step3Data") %>'></asp:TextBox><br />
> |
> | </asp:WizardStep>
> |
> | <asp:WizardStep ID="WizardStep4" runat="server" Title="Step
> 4">Step4Data:
> |
> | <asp:TextBox ID="Step4DataTextBox" runat="server" Text='<%#
> | Bind("Step4Data") %>'></asp:TextBox><br />
> |
> | </asp:WizardStep>
> |
> | </WizardSteps>
> |
> | </asp:Wizard>
> |
> | &nbsp;&nbsp;
> |
> | </InsertItemTemplate>
> |
> | </asp:FormView>
> |
> | </div>
> |
> | </form>
> |
> | </body>
> |
> | </html>
> |
> |
> |
> |
> |
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Order of events relating to a FormView inside a wizard step Andy B. Microsoft ASP .NET 1 29th Jan 2010 09:15 PM
asp:Wizard inside of a asp:FormView breacks two-way databinding (Round 4) Douglas J. Badin Microsoft ASP .NET 5 9th Feb 2006 05:29 AM
asp:Wizard inside of a asp:FormView breacks two-way databinding (Round 3) Douglas J. Badin Microsoft ASP .NET 0 1st Feb 2006 11:56 AM
asp:Wizard inside of a asp:FormView breacks two-way databinding (Round 2) Douglas J. Badin Microsoft ASP .NET 0 26th Jan 2006 09:04 PM
How can I use Wizard Control Inside of FormView Control? John R. Lewis Microsoft ASP .NET 0 4th Jan 2006 11:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:42 PM.