Hi Yuan,
With the code below, try to update the Company Name with the Wizard and
MultiView examplex. The Wizard example post backs nulls.
Add a connection string to Web.config
<add name="LocalNWind"
connectionString="SERVER=(local);DATABASE=northwind;INTEGRATED
SECURITY=sspi;" providerName="System.Data.SqlClient"/>
Multiview Example that works:
---------------------------------------------- MultiView Form after
here -------------------------------------------------------------------------
<form id="form1" runat="server">
<div>
<asp:FormView
ID="FormView1"
runat="server"
AllowPaging="true"
DataSourceID="SqlDataSource1"
DataKeyNames="CustomerID"
<ItemTemplate>
<TABLE border="1">
<TR>
<TD>
Company Name:
</TD>
<TD>
<asp:literal ID="litCompanyName" runat="server" Text='<%#
Eval("CompanyName") %>' />
</TD>
</TR>
<TR>
<TD>
Contact Name:
</TD>
<TD>
<asp:literal ID="litContactName" runat="server" Text='<%#
Eval("ContactName") %>' />
</TD>
</TR>
<TR>
<TD>
<asp:Button id="btnEdit" runat="server" text="Edit" CommandName="Edit"/>
</TD>
</TR>
</TABLE>
</ItemTemplate>
<EditItemTemplate>
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<TABLE border="1">
<TR>
<TD>
Company Name:
</TD>
<TD>
<asp:TextBox ID="txtCompanyName" runat="server" Text='<%#
Bind("CompanyName") %>' />
</TD>
</TR>
</TABLE>
</asp:View>
<asp:View ID="View2" runat="server">
<TABLE border="1">
<TR>
<TD>
Contact Name:
</TD>
<TD>
<asp:TextBox ID="txtContactName" runat="server" Text='<%#
Bind("ContactName") %>' />
</TD>
</TR>
</TABLE>
</asp:View>
</asp:MultiView>
<TABLE>
<TR>
<TD colspan="2">
<asp:Button id="btnUpdate" runat="server" text="Update"
CommandName="Update"/>
<asp:Button id="btnCancel" runat="server" text="Cancel"
CommandName="Cancel"/>
</TD>
</TR>
</TABLE>
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SQLDataSource1" runat="server"
EnableCaching="True"
ConnectionString='<%$ ConnectionStrings:LocalNWind %>'
SelectCommand="SELECT CustomerID, CompanyName, ContactName FROM Customers"
UpdateCommand="UPDATE Customers SET CompanyName = @CompanyName, ContactName
= @ContactName WHERE CustomerID = @CustomerID">
<UpdateParameters>
<asp

arameter Name="CustomerID" />
<asp

arameter Name="CompanyName" />
<asp

arameter Name="ContactName" />
</UpdateParameters>
</asp:SqlDataSource>
</div>
</form>
---------------------------------------------- MultiView Form before
here -------------------------------------------------------------------------
Wizard Example that does not work:
---------------------------------------------- Wizard Form after
here -------------------------------------------------------------------------
<form id="form1" runat="server">
<div>
<asp:FormView
ID="FormView1"
runat="server"
AllowPaging="true"
DataSourceID="SqlDataSource1"
DataKeyNames="CustomerID"
<ItemTemplate>
<TABLE border="1">
<TR>
<TD>
Company Name:
</TD>
<TD>
<asp:literal ID="litCompanyName" runat="server" Text='<%#
Eval("CompanyName") %>' />
</TD>
</TR>
<TR>
<TD>
Contact Name:
</TD>
<TD>
<asp:literal ID="litContactName" runat="server" Text='<%#
Eval("ContactName") %>' />
</TD>
</TR>
<TR>
<TD>
<asp:Button id="btnEdit" runat="server" text="Edit" CommandName="Edit"/>
</TD>
</TR>
</TABLE>
</ItemTemplate>
<EditItemTemplate>
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" Height="115px">
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="Company Name">
<TABLE border="1">
<TR>
<TD>
Company Name:
</TD>
<TD>
<asp:TextBox ID="txtCompanyName" runat="server" Text='<%#
Bind("CompanyName") %>' />
</TD>
</TR>
</TABLE>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2" runat="server" Title="Contact Name">
<TABLE border="1">
<TR>
<TD>
Contact Name:
</TD>
<TD>
<asp:TextBox ID="txtContactName" runat="server" Text='<%#
Bind("ContactName") %>' />
</TD>
</TR>
</TABLE>
</asp:WizardStep>
</WizardSteps>
<SideBarTemplate>
<asp

ataList ID="SideBarList" runat="server">
<SelectedItemStyle Font-Bold="True" />
<ItemTemplate>
<asp:LinkButton ID="SideBarButton" runat="server"></asp:LinkButton>
</ItemTemplate>
</asp

ataList>
</SideBarTemplate>
</asp:Wizard>
<TABLE>
<TR>
<TD colspan="2">
<asp:Button id="Button1" runat="server" text="Update" CommandName="Update"/>
<asp:Button id="Button2" runat="server" text="Cancel" CommandName="Cancel"/>
</TD>
</TR>
</TABLE>
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SQLDataSource1" runat="server"
EnableCaching="True"
ConnectionString='<%$ ConnectionStrings:LocalNWind %>'
SelectCommand="SELECT CustomerID, CompanyName, ContactName FROM Customers"
UpdateCommand="UPDATE Customers SET CompanyName = @CompanyName, ContactName
= @ContactName WHERE CustomerID = @CustomerID">
<UpdateParameters>
<asp

arameter Name="CustomerID" />
<asp

arameter Name="CompanyName" />
<asp

arameter Name="ContactName" />
</UpdateParameters>
</asp:SqlDataSource>
</div>
</form>
---------------------------------------------- Wizard Form before
here -------------------------------------------------------------------------
"Yuan Ren[MSFT]" said:
Hi Doug,
Thanks for posting!
For the current issue, my understanding is that the Wizard control has the
same problem with the MultiView control when place it into the FormView
control. If I have misunderstood anything, please let me know.
In this scenario, could you please give me a simple demo which can
reproduce the current problem? This will help me to perform the same test
exactly. I appreciate your understanding!
In addition, the Wizard control is the naming container control. So if
some
naming container controls is fixed, I think the Wizard control also should
be fixed. That's why I need perform some tests. Thanks for your
understanding!
Regards,
Yuan Ren [MSFT]
Microsoft Online Support