473,396 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Bind Asp Controls to ObjectDataSource.Select

I have a wizard with various ASP Controls (TextBox/ Dropdown etc...) on the
Wizard.

The last Step before user clicks the finish button displays a DetailsView
listing all the values that the user selected through the wizard.

I have a method on my Page called GetSummary, which returns an
SummaryObject, this was populated by unbinding the controls onto the object
and then Binding this object to the DetailsView within the OnActivate event.

What I would prefer, is to you set the DataSourceId property of the
DetailsView object and use the SelectMethod attribute but this does not work
because the Page state is not initialized (eg. txtPoNumber is null).

Can I do what I want to do ?

// Currently Works as Follows
#region wiz1_OnActivateStep4 (OnActivate='wiz1_OnActivateStep4')
protected void wiz1_OnActivateStep4(Object sender, EventArgs e)
{
dvSummary.DataSource = new CheckOutPageSummaryDo[] { GetSummary() };
dvSummary.DataBind();
}
#endregion

#region GetSummary
private CheckOutPageSummaryDo GetSummary()
{
CheckOutPageSummaryDo result = new CheckOutPageSummaryDo();

//result.PaymentMethod =
//
((DropDownList)wiz1.WizardSteps[0].FindControl("ddlPaymentMethod")).SelectedValue

result.PaymentMethod = ddlPaymentMethod.SelectedValue;
result.PoNumber = txtPoNumber.Text;

if (ddlPaymentMethod.SelectedValue.IndexOf("Moneytech ") == -1)
{
result.CreditCardNo = txtCreditCardNo.Text;
result.Expiry = txtExpiry.Text;
}
else
{
result.PreAuthId = txtPreAuthID.Text;
}

result.OrderTrackingId =
DistiBo.GetCurrentOrderView().CurrentOrderTracking Id;
result.TotalValue = DistiBo.GetCurrentOrderView().CartTotalValue;
result.TotalGst = DistiBo.GetCurrentOrderView().CartTotalGst;

return result;
}
#endregion

// This is what I want
<asp:DetailsView ID='dvSummary' runat='server'
DefaultMode="ReadOnly" AutoGenerateRows="false" DataSourceID='odsGetSummary' >
<Fields>
<asp:BoundField DataField='PaymentMethod'
HeaderText='Payment Method' />
<asp:BoundField DataField='PoNumber' HeaderText='Po #' />
<asp:BoundField DataField='CreditCardNo'
HeaderText='Credit Card #' NullDisplayText='---'/>
<asp:BoundField DataField='Expiry' HeaderText='Expiry'
NullDisplayText='---'/>
<asp:BoundField DataField='PreAuthID' HeaderText='PreAuth
ID' />
<asp:BoundField DataField='OrderTrackingId'
HeaderText='Order Tracking Id' />
<asp:BoundField DataField='TotalValue' HeaderText='Total
Value' DataFormatString='{0:c}' />
<asp:BoundField DataField='TotalGst' HeaderText='Total
Gst' DataFormatString='{0:c}' />
</Fields>
</asp:DetailsView>

<asp:ObjectDataSource ID="odsGetSummary" runat="server"
TypeName="Wb.Ui.Reseller.CheckOut.CheckOutPage"
DataObjectTypeName="Wb.Bo.Disti.Data.ShoppingCartS ummaryDo"
SelectMethod="GetSummary" />

May 22 '06 #1
0 905

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: J055 | last post by:
Hi I've implemented caching for my ObjectDataSource. <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnableCaching="True" CacheDuration="10" CacheExpirationPolicy="Sliding" ...
0
by: GMartin | last post by:
I have a pop-up form with a three columned Grid that has checkboxes in a Template Column in the first/left-most column. (The form is to allow users to select "Members" of a group, where they check...
0
by: Mark Micallef | last post by:
Hi, I'm having a problem using a databound dropdownlist inside a reorderlist ajax control. Here's a snippet of the code I'm using: <InsertItemTemplate> <div class="insertArea">...
1
by: Mark Micallef | last post by:
Hi, this question relates to a control in the Ajax toolkit for asp.net 2. I'm having a problem using a databound dropdownlist inside a reorderlist ajax control. Here's a snippet of the code I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.