Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 3rd, 2007, 10:48 AM
Authorized User
 
Join Date: Jul 2003
Location: Ogden, Utah, USA.
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....
  #2 (permalink)  
Old September 3rd, 2007, 10:56 AM
Registered User
 
Join Date: Aug 2007
Location: , , .
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
  #3 (permalink)  
Old September 3rd, 2007, 10:57 AM
Authorized User
 
Join Date: Jul 2003
Location: Ogden, Utah, USA.
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.
  #4 (permalink)  
Old September 3rd, 2007, 11:01 AM
Authorized User
 
Join Date: Jul 2003
Location: Ogden, Utah, USA.
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.
  #5 (permalink)  
Old September 3rd, 2007, 11:04 AM
Authorized User
 
Join Date: Jul 2003
Location: Ogden, Utah, USA.
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.
  #6 (permalink)  
Old September 3rd, 2007, 11:37 AM
Registered User
 
Join Date: Aug 2007
Location: , , .
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
  #7 (permalink)  
Old September 3rd, 2007, 12:07 PM
Registered User
 
Join Date: Aug 2007
Location: , , .
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
  #8 (permalink)  
Old September 3rd, 2007, 12:17 PM
Registered User
 
Join Date: Aug 2007
Location: , , .
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.