[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.1

How do I pass an Int32 value from one page to another?

Asked by dmasini in Programming for ASP.NET, WebApplications

Tags: Visual Web Developer 2005, all, Input string was not in a correct format, ASP.NET 2.0

Experts...

Yes I'm a rookie here so I'll try to be as clear as possible.  I have 2 .aspx pages:

Page 1) products_lookup22.aspx
Page 2) products_EMail.aspx

"Page 1" has a search then a gridview (Like a Summary) that list general information about a product as in:

(Summary)
             "Catalog"                   "Vendor"                    "Description"                 "Rec#"
details   77L8453001D           ADVANCE                 400 WHPS BLST             38
details   TQC1110WL             GE-ED&C                   BRKR CIRCUIT 1P10A     1424
details   ICQ693MDL330        GE-ED&C                    OUT MODULE 2A           1674
details   IC697PWR711          GE-FANUC                 9070 POW SUP              1682
(ETC...)

IF the user clicks on the link "details" we open a "DetailsView" just below the summary grid that provides specifics on just the single record (example: we click "details" for record 38).  We see...

(Details)
Vendor:            ADVANCE
CATALOG:       77L8453001D
DESCRIPTION:  400 WHPS BLST            
NAED V/I:         781087-11529
SOLD BY:        EA
IN STOCK:        6
LIST PRICE:      $133.66    

OK...so far all is fine.   Everythings works as advertised.  Now what I need to do is 'pass' the value '38' to "Page 2" which has its own "DetailView" to look the record up again; this form will be e-mailed in its entirety via aspNetEMail.

At the bottom of "Page 1" I have hypertext link called "Get Quote...".  NavigateURL Code is:

~/products_EMail.aspx?RecordID2=RecordID

When I run it (click on "Get Quote..." hyperlink) the page changes to the following URL and I get the error message:

(URL) http://localhost:2467/hpoll-dd/products_EMail.aspx?RecordID2=RecordID

(ERROR MESSAGE)

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.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2755599
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +112
   System.String.System.IConvertible.ToInt32(IFormatProvider provider) +43
   System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293
   System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +264
   System.Web.UI.WebControls.Parameter.get_ParameterValue() +66
   System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +254
   System.Web.UI.WebControls.SqlDataSourceView.InitializeParameters(DbCommand command, ParameterCollection parameters, IDictionary exclusionList) +274
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +754
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
   System.Web.UI.WebControls.DetailsView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   System.Web.UI.WebControls.DetailsView.EnsureDataBound() +181
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +50
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

At the top of "Page 2" I dimension "RecordID2" as in:

Dim RecordID2 As Int32

The "Page 2" datasource and query is:

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:IDC_Receiving %>"
                         
SelectCommand="SELECT [CTMFGNAME], [CTSTOCK], [CTDESCRIPTION], [DISTSKU], [CTUM], [COMMODITYNAME], [RecordID] FROM [Cooper-Master-Items-Table] WHERE (([IDCPROVIDERCODE] = @IDCPROVIDERCODE) AND ([RecordID] = @RecordID2))">

<SelectParameters>
                            <asp:Parameter DefaultValue="IDC001" Name="IDCPROVIDERCODE" Type="String" />
                            <asp:QueryStringParameter Name="RecordID2" QueryStringField=RecordID2 Type="Int32" />
</SelectParameters>
                    </asp:SqlDataSource>

OK...SO
If I run this from "Page 1" I get the error message "Input string was not in a correct format."
If I run "Page 2" standalone as in URL "http://localhost:1905/hpoll-dd/products_EMail.aspx?recordid2=38" it displays fine...

Again...'a newbie' so Any feedback would be appreciated...

Thanks in advance!

DM
 
[+][-]03/27/08 10:34 AM, ID: 21223889Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/27/08 11:08 AM, ID: 21224235Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/27/08 11:33 AM, ID: 21224445Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/27/08 11:50 AM, ID: 21224596Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/27/08 01:52 PM, ID: 21225649Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/27/08 06:31 PM, ID: 21227336Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/27/08 07:16 PM, ID: 21227547Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Programming for ASP.NET, WebApplications
Tags: Visual Web Developer 2005, all, Input string was not in a correct format, ASP.NET 2.0
Sign Up Now!
Solution Provided By: the_bachelor
Participating Experts: 1
Solution Grade: A
 
 
Loading Advertisement...
20091021-EE-VQP-81 / EE_QW_2_20070628