Little trouble with Two Way binding.


Author
Message
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Hrm... OK, does your DDL have any items in it at all?  It could be that it's trying to pass back an empty string and trying to parse that into an integer.  You might have to add a TopMostItem to your DDL to ensure that there is always a value in the list to be selected.
Justin Buist
Justin Buist
StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)
Group: Forum Members
Posts: 17, Visits: 81
Aww, crap. The code tag didn't escape the HTML. Lemme try that again.



<select name="ctl00$MainContent$ddlCompanyStatus" id="ctl00_MainContent_ddlCompanyStatus" class="dropdownlist" onfocus="elementFocus(this);" onblur="elementBlur(this);" onfocusin="elementFocus(this);" onfocusout="elementBlur(this);">

</select>


Justin Buist
Justin Buist
StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)
Group: Forum Members
Posts: 17, Visits: 81
Sure.









I think I see where you're going with this. Since the SelectedValue can't be cast to an Integer I'm kinda SOL, right? Even though it's bound to a nullable Integer?
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Can you post the rendered HTML code for the drop down list, with all of the Options and everything?  When binding back to the properties of the business object, we run the data through an Object converter class.  Most likely, it's trying to bind to an Integer field on your business object, but the data that is being sent back is not a string representation of an integer.
Justin Buist
Justin Buist
StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)
Group: Forum Members
Posts: 17, Visits: 81
I'm cleaning up my application and trying to make better use of SF as I do it. One of the things I'm trying to do is the following:



I have a page for modifying my Company BO. Every Textbox is tied to a field of the Customer BO except for one: The Status ID. That one's a Dropdownlist that is tied to the Status BO, but the StatusID is in the Company BO.



At the top of the page there's a Dropdownlist that selects what company you want to edit.



Seems simple enough.



When you select a company from the top DDL that has a NULL StatusID everything works fine -- and the Status DDL is just an empty list.



Cool.



Now, when I try and pick a different Company from the top DDL this is what I get:



Input string was not in a correct format. 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.



Exception Details: System.FormatException: Input string was not in a correct format.



....





[FormatException: Input string was not in a correct format.]

System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2753203

System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +102

System.Int32.Parse(String s) +20

MicroFour.StrataFrame.Data.ObjectConverter.ConvertValue(Object InputValue, Type InputType, Type OutputType, String FormatString) +628



[InvalidOperationException: The input value could not be converted to the output type.]

MicroFour.StrataFrame.Data.ObjectConverter.ConvertValue(Object InputValue, Type InputType, Type OutputType, String FormatString) +2720

MicroFour.StrataFrame.Data.ObjectConverter.ConvertValue(Object InputValue, Type OutputType) +64

MicroFour.StrataFrame.Business.BusinessLayer.BindDataFromWebControl(IWebBusinessBindable ControlFromBind, IWebBinding Binding) +598

MicroFour.StrataFrame.UI.Web.BasePage.BindBackControls() +227



[UIException: An error occurred while binding data to the web control 'ddlCompanyStatus'.]

MicroFour.StrataFrame.UI.Web.BasePage.BindBackControls() +579

MicroFour.StrataFrame.UI.Web.BasePage.Page_PreLoad(Object sender, EventArgs e) +83

System.EventHandler.Invoke(Object sender, EventArgs e) +0

System.Web.UI.Page.OnPreLoad(EventArgs e) +86

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +948





Any suggestions? For the life of me I can't see where I went awry here. If I change the binding to anything but TwoWay the page "works" in the sense that it doesn't blow up, but naturally the Company.StatusID either isn't updated from the UI or the UI isn't representing what's in the DB.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search