ASP.NET Forums/Data Access/DataSource Controls - SqlDataSource, ObjectDataSource, etc./Argument Not Specified For Parameter, too many arguments

Argument Not Specified For Parameter, too many arguments [Answered]RSS

5 replies

Last post Nov 30, 2010 01:10 PM by march11

.NET Teacher | .NET Videos 5 minutes
  • march11 march11

    Contributor

    2155 Points

    2142 Posts

    Re: Argument Not Specified For Parameter, too many arguments

    Nov 04, 2010 09:43 AM|march11|LINK

    THANK YOU, THANK YOU!!!! 

  • march11 march11

    Contributor

    2155 Points

    2142 Posts

    Re: Argument Not Specified For Parameter, too many arguments

    Nov 30, 2010 12:42 PM|march11|LINK

    I have added  colummn names by binding to the fields but the orginal column remains in the gridview. Is there a way to bind to the column so that I do not get duplicate columns returned in the gridview?

    Here is a snippet of the code where I created a Bound item from the Gridview, I thought it would use the columns returned but it actually created a second column, returning the results twice.

    <Columns>
                                        <asp:BoundField DataField="itemStreetDate" HeaderText="Street Date"
                                            SortExpression="itemStreetDate" DataFormatString="{0:d}" />
                                        <asp:BoundField DataField="itemVendorName" HeaderText="Ven Name"
                                            SortExpression="itemVendorName" />
                                        <asp:BoundField DataField="itemTitle" HeaderText="Title"
                                            SortExpression="itemTitle" />
                                        <asp:BoundField DataField="itemUPCID" HeaderText="UPC"
                                            SortExpression="itemUPCID" />
                                    </Columns>


     

     

     


     

     

     

     

     

     

     

     

  • march11 march11

    Contributor

    2155 Points

    2142 Posts

    Re: Argument Not Specified For Parameter, too many arguments

    Nov 30, 2010 12:48 PM|march11|LINK

    I found the answer, it is a property setting of the GRidview....

    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"

  • march11 march11

    Contributor

    2155 Points

    2142 Posts

    Re: Argument Not Specified For Parameter, too many arguments

    Nov 30, 2010 01:10 PM|march11|LINK

    Okay, I now have another issue that doesn't appear to be as easy to solve.

    It appears that since I bound the gridview in code, the wizard will not create the java for sorting on column headings. This seems to be more difficult then expected to code this manually, there must be a better way to get the column sorting function set for this process.

    I did already include the setting...

    For the Gridview, this only provides the underline under the column names, the page throws and error whenI click on the column to sort on it...

    Server Error in '/' Application.

    The GridView 'GridView2' fired event Sorting which wasn't handled.

    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.Web.HttpException: The GridView 'GridView2' fired event Sorting which wasn't handled.

    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:

    [HttpException (0x80004005): The GridView 'GridView2' fired event Sorting which wasn't handled.]
    System.Web.UI.WebControls.GridView.OnSorting(GridViewSortEventArgs e) +1321246 System.Web.UI.WebControls.GridView.HandleSort(String sortExpression, SortDirection sortDirection) +78 System.Web.UI.WebControls.GridView.HandleSort(String sortExpression) +75 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +531 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +207 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

     

     As another note, my SqlDataSource is coded inline in the asp.net page....

    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
        <asp:SqlDataSource ID="itemDataSource" runat="server" ></asp:SqlDataSource>

     


    Any suggestions?

     Thank you!!

  • ‹ Previous Thread|Next Thread ›