Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

databind asp.net wizard control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MarcG - 06 Mar 2008 15:53 GMT
I want to use a asp.net wizard control to help the user enter fields for a
single complex record. The idea is for each page to solicit data for a subset
of the fields and at the end do the update.

The wizard has a DataBind method, but I can't find a way to associate the
SqlDataSource on the page with the wizard control itself.

In the aspx I have...

   <asp:Wizard ID="surveyDescrWizard" runat="server" Width="800px">
       .....
       <WizardSteps>
           <asp:WizardStep runat="server" Title="Page 2">
               Title:
               <asp:Literal ID="Literal1" runat="server"
Text="LiteralText"></asp:Literal>
               <asp:TextBox ID="TextBox1" runat="server"
BorderStyle="Double" Text='<%# Bind("Title") %>'></asp:TextBox>
           </asp:WizardStep>
       </WizardSteps>
   </asp:Wizard>
   <asp:SqlDataSource ID="SqlDataSource1" runat="server" ...>
        ....
  </asp:SqlDataSource>

In my page load event I have...
           if (!IsPostBack)
           {
               surveyDescrWizard.DataBind();
           }

I get the exception ...
 "Databinding methods such as Eval(), XPath(), and Bind() can only be used
in the context of a databound control."

On reflection (so to speak) this makes perfect sense since there is no
property or method that lets you associate the datasource with the wizard
itself.

Since the Wizard control offers a DataBind() method, there must be some way
to do this, but I just can't see it.

Thx
Marc
Steven Cheng - 07 Mar 2008 01:57 GMT
Hi Marc,

As for the error you encountered, it is because Wizard control is not a
databound control(such as Gridview, FormView or dropdownlist...).  
Therefore, Wizard control does not support databinding expression directly
located in its member template.  The "DataBind" method you mentioned is
used for simple databind(for Wizard control's own properties) e.g.

=============
<asp:Wizard ID="Wizard1"  ...    Width='<%#    ..... %>'    Height='<%#
...%>'  >
...
==========

If you do need to use databinding to populate controls in Wizard, I think
you may consider put a databound template control inside Wizard control's
step so as to wrapper other controls that need databinding.  How do you
think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we

can improve the support we provide to you. Please feel free to let my
manager know what you think of

the level of service provided. You can send feedback directly to my manager
at: msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response

from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take

approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution.

The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump

analysis issues. Issues of this nature are best handled working with a
dedicated Microsoft Support

Engineer by contacting Microsoft Customer Support Services (CSS) at

http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: =?Utf-8?B?TWFyY0c=?= <JoePtfsk@newsgroup.nospam>
>Subject: databind asp.net wizard control
>Date: Thu, 6 Mar 2008 07:53:02 -0800

>I want to use a asp.net wizard control to help the user enter fields for a
>single complex record. The idea is for each page to solicit data for a subset
[quoted text clipped - 40 lines]
>Thx
>Marc
MarcG - 07 Mar 2008 08:39 GMT
Steven,

A clear response, thank you. Unfortunately it was more or less what I was
expecting.

> If you do need to use databinding to populate controls in Wizard, I think
> you may consider put a databound template control inside Wizard control's
> step so as to wrapper other controls that need databinding.  How do you
> think?

You suggested putting a databound control inside the Wizard steps and that
is actually what I was hoping to avoid.

Here's the problem...

Functionally, I want to break up the process of entering the data into steps
since there are too many fields for the user to deal with at one time - the
UI would be much too confusing and cumbersome. So the Wizard is conceptually
a perfect solution.

Programmatically, I don't see a good design pattern. Each step would have to
have its own databound control, eg.., a FormView or DetailView. Each of these
has to be bound to a datasource. However, I can't use a single datasource for
the entire Wizard since, although all FormViews could share the Select
statement, they each have to have their own Update statement since each would
only have its own variables (fields). I think this approach would also mean
that I have to update the record in multiple steps, one for each Wizard step.

I'd like to use the Wizard to collect the data and then do a single Update
when the user clicks "Finish." I know I can do this using unbound input
fields and writing code to collect the data values from the Wizard,
constructing a record and doing the update manually. I was hoping to used the
bound data model.

Marc
Steven Cheng - 10 Mar 2008 03:32 GMT
Hi Marc,

Yes, putting an additional databound control here is only to make each
wizard step template to able to use the datasource control. That would make
the design not quite elegant.  I'm afraid so far the Wizard control can not
quite support databinding with datasource control or event bind fields in
all template with a single datasource control. So far what I can get to
make this work is do all the data/fields collection in our own code and
then call Data Access class(or datasource control ) to programmatically do
the update. I think you may already tried this or thought this to be a
backup plan?

Best regards,

Steven Cheng
Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we

can improve the support we provide to you. Please feel free to let my
manager know what you think of

the level of service provided. You can send feedback directly to my manager
at: msdnmg@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?TWFyY0c=?= <JoePtfsk@newsgroup.nospam>
>References:  <2DD78A00-7CC2-4433-AFC5-9EB440A1FA9A@microsoft.com>
<6X0Fqa$fIHA.6616@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: databind asp.net wizard control
>Date: Fri, 7 Mar 2008 00:39:01 -0800

>Steven,
>
[quoted text clipped - 31 lines]
>
>Marc

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.