Asked by:
adding quiz engine

Question
-
User1906294024 posted
I tried to add the quiz engine found on MSDN to the club site but I recieve the following error:
Server Error in '/finalsite' Application.
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:
Line 90: <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource2"> Line 91: <ItemTemplate> Line 92: <asp:HyperLink Line 93: ID="HyperLink1" runat="server" NavigateUrl='<%# "start.aspx?testid=" & Cint("QuizID") %>' Line 94: Text='<%# Eval("Title") %>'></asp:HyperLink><br />
Source File: E:\finalsite\learn\QuizVB\Default.aspx Line: 92
Stack Trace:
[FormatException: Input string was not in a correct format.] Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat) +218 Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) +93 [InvalidCastException: Conversion from string "QuizID" to type 'Integer' is not valid.] Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) +252 ASP.learn_quizvb_default_aspx.__DataBinding__control25(Object sender, EventArgs e) in E:\finalsite\learn\QuizVB\Default.aspx:92 System.Web.UI.Control.OnDataBinding(EventArgs e) +80 System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +198 System.Web.UI.Control.DataBind() +12 System.Web.UI.Control.DataBindChildren() +212 System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +208 System.Web.UI.Control.DataBind() +12 System.Web.UI.WebControls.DataList.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +130 System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +615 System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +56 System.Web.UI.WebControls.BaseDataList.DataBind() +62 System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +55 System.Web.UI.WebControls.BaseDataList.CreateChildControls() +62 System.Web.UI.Control.EnsureChildControls() +97 System.Web.UI.Control.PreRenderRecursiveInternal() +50 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5731
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 <!-- [FormatException]: Input string was not in a correct format. at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat) at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) [InvalidCastException]: Conversion from string "QuizID" to type 'Integer' is not valid. at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) at ASP.learn_quizvb_default_aspx.__DataBinding__control25(Object sender, EventArgs e) in E:\finalsite\learn\QuizVB\Default.aspx:line 92 at System.Web.UI.Control.OnDataBinding(EventArgs e) at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBind() at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBind() at System.Web.UI.WebControls.DataList.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) at System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) at System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) at System.Web.UI.WebControls.BaseDataList.DataBind() at System.Web.UI.WebControls.BaseDataList.EnsureDataBound() at System.Web.UI.WebControls.BaseDataList.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.learn_quizvb_default_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->
Thursday, March 30, 2006 2:41 AM
All replies
-
User1275632693 posted
[InvalidCastException: Conversion from string "QuizID" to type 'Integer' is not valid.]
You are converting a QuizID to a type Integer and it is rejecting it, Cint("QuizID"). What datatype is QuizID, is it a String?
Thursday, March 30, 2006 8:37 AM -
User-1346905220 posted
Since you are going to concatentate the QuizID with the URL string shouldn't you cast it from an integer to a string?
ID="HyperLink1" runat="server" NavigateUrl='<%# "start.aspx?testid=" & Cstr("QuizID") %>'
Hope this helps.
-Mike
Thursday, March 30, 2006 6:34 PM