Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 3rd, 2007, 10:48 AM
Authorized User
 
Join Date: Jul 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Tremmorkeep Send a message via MSN to Tremmorkeep Send a message via Yahoo to Tremmorkeep
Default just asp.net? or? values not populating in cb

SO, I modified some of the code to extend membership (actually by adding another table and using the ProviderKey as the relationship)..

I have a section thats updating some of it, and I have another button that updates more...I have about 11 textboxes, and 3 dropdownlist's. Funny enough, the ddl's have the correct values in them, but no matter what I type into the textboxes, and debug, the value's in the code beside are always zero, zero (these are for height, weight, etc). any ideas? The only 'complicated' thing about the page is that this 'personal info' section is wrapped in an ajax:TabContainer control. I just dont get how ddlHairColor.SelectedValue returns the right value while txtWeight.Text returns a 0.

Any ideas? Would love it....
 
Old September 3rd, 2007, 10:56 AM
Registered User
 
Join Date: Aug 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Maybe if you show what one of the TabPanels has in it that might help us all figure out a possible reason?

Christopher
 
Old September 3rd, 2007, 10:57 AM
Authorized User
 
Join Date: Jul 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Tremmorkeep Send a message via MSN to Tremmorkeep Send a message via Yahoo to Tremmorkeep
Default

<ajax:TabPanel ID="tpPersonalInfo" runat="server">
        <HeaderTemplate>Personal Info</HeaderTemplate>
        <ContentTemplate>

        <asp:Label ID="lblHeight" runat="server" Text="Height:" AssociatedControlID="txtHeight" />
        <asp:TextBox ID="txtHeight" runat="server" />

        <asp:Label ID="lblWeight" runat="server" Text="Weight:" AssociatedControlID="txtWeight" />
        <asp:TextBox ID="txtWeight" runat="server" />

        <asp:Label ID="lblChestBust" runat="server" Text="Chest/Bust:" AssociatedControlID="txtChestBust" />
        <asp:TextBox ID="txtChestBust" runat="server" />

        <asp:Label ID="lblWaist" runat="server" Text="Waist:" AssociatedControlID="txtWaist" />
        <asp:TextBox ID="txtWaist" runat="server" />

        <asp:Label ID="lblHips" runat="server" Text="Hips:" AssociatedControlID="txtHips" />
        <asp:TextBox ID="txtHips" runat="server" />

        <asp:Label ID="lblInseam" runat="server" Text="Inseam:" AssociatedControlID="txtInseam" />
        <asp:TextBox ID="txtInseam" runat="server" />

        <asp:Label ID="lblShoeSize" runat="server" Text="**************** Size:" AssociatedControlID="txtShoeSize" />
        <asp:TextBox ID="txtShoeSize" runat="server" />

        <asp:Label ID="lblNeck" runat="server" Text="Neck:" AssociatedControlID="txtNeck" />
        <asp:TextBox ID="txtNeck" runat="server" />

        <asp:Label ID="lblEthnicity" runat="server" AssociatedControlID="ddlEthnicity" Text="Ethnicity:" />
        <asp:DropDownList ID="ddlEthnicity" runat="server" DataSourceID="odsEthnicity" DataTextField="EthnicityName" DataValueField="EthnicityID">

        </asp:DropDownList>

        <asp:Label ID="lblEyeColor" runat="server" AssociatedControlID="ddlEyeColor" Text="Eye Color:" />
        <asp:DropDownList ID="ddlEyeColor" runat="server" DataSourceID="odsEyeColor" DataTextField="EyeColorName" DataValueField="EyeColorID">

        </asp:DropDownList>

        <asp:Label ID="lblHairColor" runat="server" AssociatedControlID="ddlHairColor" Text="Hair Color:" />
        <asp:DropDownList ID="ddlHairColor" runat="server" DataSourceID="odsHairColor" DataTextField="HairColorName" DataValueField="HairColorID">

        </asp:DropDownList>

        <asp:Label ID="lblSkills" runat="server" AssociatedControlID="txtSkills" Text="Skills:" />
        <asp:TextBox ID="txtSkills" runat="server" TextMode="MultiLine" Columns="40" Rows="20" />

        <asp:Button ID="btnUpdatePersonalInfo" runat="server" Text="Update Personal Info" OnClick="btnUpdatePersonalInfo_OnClick" />
        </ContentTemplate>
    </ajax:TabPanel>


//code behind.
 protected void btnUpdatePersonalInfo_OnClick(object sender, EventArgs e)
        {
            if (ExtrasProfileID > 0)
                ExtrasProfile.UpdatePersonalInfo(ExtrasProfileID, FormatHeight(txtHeight.Text), Convert.ToInt32(txtWeight.Text), Convert.ToInt32(txtChestBust.Text),
                    Convert.ToInt32(txtWaist.Text), Convert.ToInt32(txtHips.Text), Convert.ToInt32(txtInseam.Text),
                    Convert.ToInt32(txtShoeSize.Text), Convert.ToInt32(txtNeck.Text), Convert.ToInt32(ddlEthnicity.SelectedValue),
                    Convert.ToInt32(ddlEyeColor.SelectedValue), Convert.ToInt32(ddlHairColor.SelectedValue), txtSkills.Text);
        }


//end code


The ddl lists are populating correctly. The basic Info tab is also working perfectly...maybe I've just stared at this thing too long.
 
Old September 3rd, 2007, 11:01 AM
Authorized User
 
Join Date: Jul 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Tremmorkeep Send a message via MSN to Tremmorkeep Send a message via Yahoo to Tremmorkeep
Default

I guess a valid question would be if the Page_Load event fires before my OnClick event... if it does, then it would load new 'empty' values from the table into the form, and then the OnClick event would fire...and then hose me. let me put a break point in and see what the H.
 
Old September 3rd, 2007, 11:04 AM
Authorized User
 
Join Date: Jul 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Tremmorkeep Send a message via MSN to Tremmorkeep Send a message via Yahoo to Tremmorkeep
Default

You gotta be kidding me. So, the problem is the page_load event IS firing first...so its getting the data from the table (Which is currently empty) and pushing it into the form...funny that the values from the ddl's are saving into the table though, probably through state....any ideas on this solution? I would think it would fire a button event first, then re-load the page....grr.
 
Old September 3rd, 2007, 11:37 AM
Registered User
 
Join Date: Aug 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just throwing some ideas out there at the moment. I mean everything looks reasonably (or theoretically) ok. So what happens if you "take a policy of subtraction"? By that I mean what happens if you take out everything but:
Code:
<asp:Label ID="lblHeight" runat="server" Text="Height:" AssociatedControlID="txtHeight" />
        <asp:TextBox ID="txtHeight" runat="server" />

from the tabpanel then add in the button and then add in the handler...etc?

Oh and just one clarification if I might. you say that the values are zero. for a textbox it would be .Text and that would be "" if not filled in. Or are you saying they're null? In other words when you step into ExtrasProfile.UpdatePersonalInfo what is the value of txtHeight.Text?

Again just throwing out some ideas,
Christopher
 
Old September 3rd, 2007, 12:07 PM
Registered User
 
Join Date: Aug 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh! Duh! (Or at least I think Duh, I'm doing a few things here LOL) what if you do a SaveControlState and a LoadControlState? Will that take care of it? When you hit that button (btnUpdatePersonalInfo) it's doing a postback.

If it were me I'd put the save and a cancel button outside of any of the panels and then let that do the postback and save all the data.But that's just a thought. I might have missed something as far as your redesign.

Christopher
 
Old September 3rd, 2007, 12:17 PM
Registered User
 
Join Date: Aug 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ooops sorry forgot to mention you might want to take a look at UserProfile.aspx.cs as far as the LoadControlState and SaveControlState.

Christopher





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Form Values in ASP.Net sankar General .NET 10 September 21st, 2006 11:13 AM
populating a dropdown list with values from datab akshay144 VS.NET 2002/2003 5 May 12th, 2006 10:15 AM
populating dropdown values rupen Classic ASP Basics 16 October 10th, 2005 09:48 AM
Populating Combo with values from Excel r_ganesh76 Excel VBA 2 February 4th, 2005 06:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.