locked
error when selecting Cancel on Even_Edit.aspx RRS feed

  • Question

  • User-938130432 posted

    I'm gettign the following error when selecting the cancel button

    Server Error in '/ClubWebSite1' 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:

    The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

    1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

      <%@ Page Language="C#" Debug="true" %>

    or:

    2) Add the following section to the configuration file of your application:

    <configuration>
       <system.web>
           <compilation debug="true"/>
       </system.web>
    </configuration>

    Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

    Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

    Stack Trace:

    [FormatException: Input string was not in a correct format.]
       Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat) +216
       Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) +93
    
    [InvalidCastException: Conversion from string "" to type 'Integer' is not valid.]
       Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) +251
       Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(Object Value) +1030
       ASP.events_view_aspx.get_EventID() +98
       ASP.events_view_aspx.Page_Load(Object sender, EventArgs e) +58
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +43
       System.Web.UI.Control.OnLoad(EventArgs e) +80
       System.Web.UI.Control.LoadRecursive() +49
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3750
    

    Sunday, May 4, 2008 8:41 PM

All replies

  • User-419561974 posted

     pls post your code,so it's focus more on error.

    thanks 

    Monday, May 5, 2008 3:08 AM
  • User-938130432 posted
    <%@ Page Language="VB" MasterPageFile="~/Default.master" Title="Untitled Page" %>

    <%@ Import Namespace="System.Data" %>

    <%@ Register TagPrefix="Club" Namespace="ClubSite" %>

    <%@ Register TagPrefix="Club" TagName="LoginBanner" Src="LoginBanner.ascx" %>

    <%@ Register TagPrefix="Club" TagName="ImageThumbnail" Src="ImageThumbnail.ascx" %>

    <%@ Register TagPrefix="Club" TagName="Photopicker" Src="photos_formpicker.ascx" %>

    <%@ Register TagPrefix="Club" TagName="Durationpicker" Src="Durationpicker.ascx" %>

    <%@ Register TagPrefix="Club" TagName="Locationpicker" Src="Locations_picker.ascx" %>

    <script runat="server">

    Private EventID, prevEventID, nextEventID As Integer

    Const INVALIDID As Integer = -1

     

     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

    If Not IsPostBack Then

    'Initialize the fields

     

    Dim action As Object = Request.QueryString("Action")

    If Not action Is Nothing Then

    Select Case LCase(CStr(action))

    case "new"

    'We are in new mode

    FormView1.ChangeMode(FormViewMode.Insert)

    Dim lp As LocationsPicker = CType(FormView1.FindControl("LocationPicker1"), LocationsPicker)

    lp.LocationID = Nothing

    Dim dp As DurationPicker = CType(FormView1.FindControl("dtpicker"), DurationPicker)

    dp.startDateTime = Now

    dp.endDateTime = Now.AddHours(3)

    Dim slp As TextBox = CType(FormView1.FindControl("staticURLTextBox"), TextBox)

    slp.Enabled = False

     

    Case "delete"

    SqlDataSource1.Delete()

    Response.Redirect(
    "Events_list.aspx")

     

    Case Else

    'We are in edit mode

    Dim cb As CheckBox = CType(FormView1.FindControl("CheckBox1"), CheckBox)

    Dim surl As TextBox = CType(FormView1.FindControl("staticURLTextBox"), TextBox)

    If Not surl.Text Is Nothing AndAlso surl.Text <> "" Then

    cb.Checked = True

    surl.Enabled = True

    Else

    surl.Enabled = False

    End If

    End Select

    End If

    End If

    End Sub

    Protected Sub FormView1_ItemUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewUpdatedEventArgs)

    Response.Redirect("events_view.aspx?eventID=" & e.Keys("id").ToString)

    End Sub

     

    Protected Sub FormView1_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArgs)

    Response.Redirect("events_list.aspx")

    End Sub

    Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)

    Dim cb As CheckBox = CType(FormView1.FindControl("CheckBox1"), CheckBox)

    Dim surl As TextBox = CType(FormView1.FindControl("StaticURLTextBox"), TextBox)

    If cb.Checked Then

    surl.Enabled = True

    Else

    surl.Enabled = False

    End If

    End Sub

     

     

    </script>

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <div id="body">

    <Club:LoginBanner ID="LoginBanner1" runat="server" />

    <div class="actionbuttons">

    <Club:RolloverLink ID="Logoutbtn" runat="server" Text="Add New Event" OnClientClick="foo"

    NavigateURL="Event_edit.aspx?Action=New" />

    </div>

    <div class="fullwidth">

    <h3>

    Event Details</h3>

    <div class="dashedline">

    </div>

    <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="id"

    DefaultMode="Edit" OnItemInserted="FormView1_ItemInserted" OnItemUpdated="FormView1_ItemUpdated"

    Width="100%">

    <InsertItemTemplate>

    <div class="actionbuttons">

    <Club:RolloverButton ID="GreenRolloverButton2" CommandName="Insert" Text="Add Event"

    runat="server" />

    <Club:RolloverLink ID="GreenRolloverLink1" Text="Cancel" runat="server" NavigateURL='<%# "Events_view.aspx?EventID=" & Cstr(Eval("ID")) %>' />

     

    </div>

    <div class="dashedline">

    </div>

    <table>

    <tr>

    <td class="formlabel">

    Event Heading:

    </td>

    <td align="left">

    <asp:TextBox ID="titleTextBox" runat="server" Width="500px" Text='<%# Bind("title") %>'></asp:TextBox>

    </td>

    </tr>

    <tr>

    <td class="formlabel">

    Link:

    </td>

    <td align="left">

    <asp:CheckBox ID="CheckBox1" runat="server" Text="Use a link instead of inline content for this anouncement:" /><br />

    Link:

    <asp:TextBox Text='<%# Bind("staticURL") %>' runat="server" ID="staticURLTextBox"

    Width="450px" />

    </td>

    </tr>

    <tr>

    <td class="formlabel">

    Location:

    </td>

    <td align="left">

    <Club:Locationpicker ID="LocationPicker1" runat="server" LocationID='<%# Bind("location")%>' />

    </td>

    </tr>

    <tr>

    <td class="formlabel">

    <asp:Label ID="Label1" runat="server" Text="Description:" />

    </td>

    <td align="left">

    <asp:TextBox Text='<%# Bind("description") %>' runat="server" ID="descriptionTextBox"

    Rows="10" TextMode="MultiLine" Width="500px" Height="166px"></asp:TextBox>

    </td>

    </tr>

    <tr>

    <td class="formlabel">

    Event Date:</td>

    <td align="left">

    <Club:Durationpicker ID="dtpicker" runat="server" startDateTime='<%#Bind("Starttime") %>' enddatetime='<%#Bind("endtime") %>' />

    </td>

    </tr>

    <tr>

    <td class="formlabel">

    Photo:</td>

    <td align="left">

    <Club:Photopicker ID="Photopicker1" runat="server" ImageId='<%# Bind("photo") %>' />

    </td>

    </tr>

    </table>

    <div class="dashedline">

    </div>

    <div class="actionbuttons">

    <Club:RolloverButton ID="apply1" CommandName="Insert" Text="Add Event" runat="server" />

    <Club:RolloverLink ID="Cancel" Text="Cancel" runat="server" NavigateURL='<%# "Events_view.aspx?EventID=" & Cstr(Eval("ID")) %>' />

    </div>

    </InsertItemTemplate>

    <EditItemTemplate>

    <div class="actionbuttons">

    <Club:RolloverButton ID="GreenRolloverButton1" CommandName="Update" Text="Apply Changes"

    runat="server" />

    <Club:RolloverLink ID="GreenRolloverLink1" Text="Cancel" runat="server" NavigateURL='<%# "Events_view.aspx?EventID=" & Cstr(Eval("ID")) %>' />

    </div>

    <div class="dashedline">

    </div>

    <table>

    <tr>

    <td class="formlabel">

    Event Heading:

    </td>

    <td align="left">

     

    <asp:TextBox ID="titleTextBox" runat="server" Width="500px" Text='<%# Bind("title") %>'></asp:TextBox>

    </td>

    </tr>

    <tr>

    <td class="formlabel">

    Link:

    </td>

    <td align="left">

    <asp:CheckBox ID="CheckBox1" runat="server" Text="Use a link instead of inline content for this anouncement:" /><br />

    Link:

    <asp:TextBox Text='<%# Bind("staticURL") %>' runat="server" ID="staticURLTextBox"

    Width="450px" />

    </td>

    </tr>

    <tr>

    <td class="formlabel">

    Location:

    </td>

    <td align="left">

     

    <Club:Locationpicker ID="LocationPicker1" runat="server" LocationID='<%# Bind("location")%>' />

    </td>

    </tr>

    <tr>

    <td class="formlabel">

    <asp:Label ID="Label1" runat="server" Text="Description:" />

    </td>

    <td align="left">

    <asp:TextBox Text='<%# Bind("description") %>' runat="server" ID="descriptionTextBox"

    Rows="10" TextMode="MultiLine" Width="500px" Height="166px"></asp:TextBox>

    </td>

    </tr>

    <tr>

    <td class="formlabel">

    Event Date:</td>

    <td align="left">

    <Club:Durationpicker ID="dtpicker" runat="server" startDateTime='<%#Bind("Starttime") %>' endDateTime='<%#Bind("endtime") %>'/>

     

    </td>

    </tr>

    <td class="formlabel">

    Photo:</td>

    <td align="left">

     

    <Club:Photopicker ID="Photopicker1" runat="server" ImageId='<%# Bind("photo") %>' />

    </td>

    </tr>

    </table>

    <div class="dashedline">

    </div>

    <div class="actionbuttons">

    <Club:RolloverButton ID="apply1" CommandName="Update" Text="Apply Changes" runat="server" />

    <Club:RolloverLink ID="Cancel" Text="Cancel" runat="server" NavigateURL='<%# "Events_view.aspx?EventID=" & Cstr(Eval("ID")) %>' />

    </div>

    </EditItemTemplate>

    </asp:FormView>

    </div>

    </div>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>"

    SelectCommand="SELECT dbo.Events.id, dbo.Events.starttime, dbo.events.endtime, dbo.Events.title, dbo.Events.description, dbo.Events.staticURL, dbo.Events.photo, dbo.Events.location, dbo.Locations.title AS locationname FROM dbo.Events LEFT OUTER JOIN dbo.Locations ON dbo.Events.location = dbo.Locations.id where Events.id=@id"

    InsertCommand="INSERT INTO Events(starttime, endtime, title, description, staticURL, location, photo) VALUES (@starttime, @endtime, @title, @description, @staticURL, @location, @photo)"

    UpdateCommand="UPDATE Events SET starttime = @starttime, endtime=@endtime, title = @title, description = @description, staticURL = @staticURL, location = @location, photo = @photo WHERE (id = @id)"

    DeleteCommand="DELETE Events WHERE id=@id" OldValuesParameterFormatString="{0}">

    <SelectParameters>

    <asp:QueryStringParameter Name="id" QueryStringField="ID" />

    </SelectParameters>

    <UpdateParameters>

    <asp:Parameter Name="starttime" Type="DateTime" />

    <asp:Parameter Name="endtime" Type="DateTime" />

    <asp:Parameter Name="title" />

    <asp:Parameter Name="description" />

    <asp:Parameter Name="staticURL" />

    <asp:Parameter Name="location" />

    <asp:Parameter Name="photo" />

    <asp:Parameter Name="id" />

    </UpdateParameters>

    <InsertParameters>

    <asp:Parameter Name="starttime" Type="DateTime" />

    <asp:Parameter Name="endtime" Type="DateTime" />

    <asp:Parameter Name="title" />

    <asp:Parameter Name="description" />

    <asp:Parameter Name="staticURL" />

    <asp:Parameter Name="location" />

    <asp:Parameter Name="photo" />

    <asp:Parameter Name="id" />

    </InsertParameters>

    <DeleteParameters>

    <asp:QueryStringParameter Name="id" QueryStringField="ID" />

    </DeleteParameters>

    </asp:SqlDataSource>

    </asp:Content>

    Monday, May 5, 2008 10:39 AM
  • User-401140269 posted

    hello,

    have you read this post?
    http://forums.asp.net/t/970081.aspx?PageIndex=3

    i got same problem but i'm using C#, could anyone help me?

    thanks.

    Wednesday, July 9, 2008 8:47 PM
  • User-401140269 posted

    Server Error in '/iss' 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 62:                 if (id != null)
    Line 63:                 {
    Line 64:                     m_EventID = System.Convert.ToInt32(id);
    Line 65:                 }
    Line 66:                 else

    Source File: c:\Documents and Settings\User\Desktop\iss\Events_View.aspx    Line: 64

    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.ToInt32(Object value) +25
       ASP.events_view_aspx.get_EventID() in c:\Documents and Settings\User\Desktop\iss\Events_View.aspx:64
       ASP.events_view_aspx.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\User\Desktop\iss\Events_View.aspx:14
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +43
       System.Web.UI.Control.OnLoad(EventArgs e) +80
       System.Web.UI.Control.LoadRecursive() +49
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3750
    

    This error shows after cancelling add new events in C#

    Wednesday, July 9, 2008 9:00 PM