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
by: the_bachelorPosted on 2008-03-27 at 10:34:06ID: 21223889
1) what I'll do If I were you is to put a HyperLink server control at the bottom of the page
and set its NavigateUrl Property at run time when you select the item.
2) I'm not real familiar with DetailViews but I imagine you could Have a template for the GetQuote link in such a way that its url is once again set properly when you click on Details.
post the markup i'll see what I can do (granted that u still havent found the answer)