Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error : Does not have same signature as delegate

Error : Does not have same signature as delegate

Scheduled Pinned Locked Moved ASP.NET
htmlgraphicsdesignsysadminhelp
13 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rock Star
    wrote on last edited by
    #1

    Hi, I have a datagrid in which I have a select command column on clicking of it I am try to bind a dataset with detail view but I am getting the following error The aspx code for it is <%@ Page Language="VB" AutoEventWireup="false" CodeFile="DG_Example.aspx.vb" Inherits="DG_Example" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Test Application</title> </head> <body> <form id="form1" runat="server"> <div> <asp:GridView ID="Generic_DG" runat="server" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" DataKeyNames="ProdId" OnSelectedIndexChanged="Generic_DG_SelectedIndexChanged3"> <Columns> <asp:BoundField DataField="ProdName" HeaderText="Product" SortExpression="ProdName" > <HeaderStyle Font-Names="Arial" Font-Size="12px" /> <ItemStyle Font-Names="Arial" Font-Size="12px" /> </asp:BoundField> <asp:CommandField ShowEditButton="true" /> <asp:CommandField ShowSelectButton="true" /> </Columns> </asp:GridView> <br /> <br /> <asp:DetailsView ID="Generic_Det" runat="server" Height="50px" Width="125px" DataKeyNames="ProdId"> <Fields> <asp:BoundField DataField="ProdName" HeaderText="Product" SortExpression="ProdName" > <HeaderStyle Font-Names="Arial" Font-Size="12px" /> <ItemStyle Font-Names="Arial" Font-Size="12px" /> </asp:BoundField> <asp:CommandField ShowEditButton="True" /> </Fields> </asp:DetailsView> </div> </form> </body> </html> This is the code behind for it is as follows Imports System.Data Imports System Imports System.Data.SqlClient Imports System.Collections Imports System.ComponentModel Imports System.Drawing Imports System.Web Imports System.Web.SessionState Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.HtmlControls Imports System.Data.OleDb Imports System.Configuration Partial Class DG_Example Inherits System.

    S 1 Reply Last reply
    0
    • R Rock Star

      Hi, I have a datagrid in which I have a select command column on clicking of it I am try to bind a dataset with detail view but I am getting the following error The aspx code for it is <%@ Page Language="VB" AutoEventWireup="false" CodeFile="DG_Example.aspx.vb" Inherits="DG_Example" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Test Application</title> </head> <body> <form id="form1" runat="server"> <div> <asp:GridView ID="Generic_DG" runat="server" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" DataKeyNames="ProdId" OnSelectedIndexChanged="Generic_DG_SelectedIndexChanged3"> <Columns> <asp:BoundField DataField="ProdName" HeaderText="Product" SortExpression="ProdName" > <HeaderStyle Font-Names="Arial" Font-Size="12px" /> <ItemStyle Font-Names="Arial" Font-Size="12px" /> </asp:BoundField> <asp:CommandField ShowEditButton="true" /> <asp:CommandField ShowSelectButton="true" /> </Columns> </asp:GridView> <br /> <br /> <asp:DetailsView ID="Generic_Det" runat="server" Height="50px" Width="125px" DataKeyNames="ProdId"> <Fields> <asp:BoundField DataField="ProdName" HeaderText="Product" SortExpression="ProdName" > <HeaderStyle Font-Names="Arial" Font-Size="12px" /> <ItemStyle Font-Names="Arial" Font-Size="12px" /> </asp:BoundField> <asp:CommandField ShowEditButton="True" /> </Fields> </asp:DetailsView> </div> </form> </body> </html> This is the code behind for it is as follows Imports System.Data Imports System Imports System.Data.SqlClient Imports System.Collections Imports System.ComponentModel Imports System.Drawing Imports System.Web Imports System.Web.SessionState Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.HtmlControls Imports System.Data.OleDb Imports System.Configuration Partial Class DG_Example Inherits System.

      S Offline
      S Offline
      Sherin Iranimose
      wrote on last edited by
      #2

      Rock Star. wrote:

      Protected Sub Generic_DG_SelectedIndexChanged3(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)

      How did you created that function,Is it an automatically generated, Or User defined? Where you are calling this function? Because No control handle attached to it. The second argument 'e' must be a type of System.EventArgs

      EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

      R 1 Reply Last reply
      0
      • S Sherin Iranimose

        Rock Star. wrote:

        Protected Sub Generic_DG_SelectedIndexChanged3(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)

        How did you created that function,Is it an automatically generated, Or User defined? Where you are calling this function? Because No control handle attached to it. The second argument 'e' must be a type of System.EventArgs

        EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

        R Offline
        R Offline
        Rock Star
        wrote on last edited by
        #3

        Its a user defined function and I am calling it on the selected index changed event of datagrid.

        Rock Star

        S 1 Reply Last reply
        0
        • R Rock Star

          Its a user defined function and I am calling it on the selected index changed event of datagrid.

          Rock Star

          S Offline
          S Offline
          Sherin Iranimose
          wrote on last edited by
          #4

          In Your aspx page u can see, in the GV code, Following line OnSelectedIndexChanged="Generic_DG_SelectedIndexChanged3" Delete it. The function that you created is already attached to GV that is the problem. And call this function inside the GV's SelectedIndexChanged

          EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

          R 1 Reply Last reply
          0
          • S Sherin Iranimose

            In Your aspx page u can see, in the GV code, Following line OnSelectedIndexChanged="Generic_DG_SelectedIndexChanged3" Delete it. The function that you created is already attached to GV that is the problem. And call this function inside the GV's SelectedIndexChanged

            EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

            R Offline
            R Offline
            Rock Star
            wrote on last edited by
            #5

            Hi, I did it what you have mentioned but by deleting it for understanding the flow I have kept a msgbox in the function but it is not calling the Generic_DG_SelectedIndexChanged3 function becauuse it is not showing that msgbox too. One more thing I didnt understood your last comment i.e "And call this function inside the GV's SelectedIndexChanged "

            Rock Star

            S 2 Replies Last reply
            0
            • R Rock Star

              Hi, I did it what you have mentioned but by deleting it for understanding the flow I have kept a msgbox in the function but it is not calling the Generic_DG_SelectedIndexChanged3 function becauuse it is not showing that msgbox too. One more thing I didnt understood your last comment i.e "And call this function inside the GV's SelectedIndexChanged "

              Rock Star

              S Offline
              S Offline
              Sherin Iranimose
              wrote on last edited by
              #6

              When you pass a DataGridCommandEventArgs to a function you can assign that function only to OnEditCommand,OnUpdateCommand,OnItemCommand etc... I dont think there is a command event for SelectedIndexChanged.

              EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

              R 1 Reply Last reply
              0
              • R Rock Star

                Hi, I did it what you have mentioned but by deleting it for understanding the flow I have kept a msgbox in the function but it is not calling the Generic_DG_SelectedIndexChanged3 function becauuse it is not showing that msgbox too. One more thing I didnt understood your last comment i.e "And call this function inside the GV's SelectedIndexChanged "

                Rock Star

                S Offline
                S Offline
                Sherin Iranimose
                wrote on last edited by
                #7

                1.You can change your code that work with, SelectedIndexChanged of grid view. Dim index As Integer = Generic_DG.SelectedIndex cmd.Parameters.Add("@ProdId", SqlDbType.Int).Value = Generic_DG.DataKeys(index).Value.ToString()

                EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

                R 1 Reply Last reply
                0
                • S Sherin Iranimose

                  When you pass a DataGridCommandEventArgs to a function you can assign that function only to OnEditCommand,OnUpdateCommand,OnItemCommand etc... I dont think there is a command event for SelectedIndexChanged.

                  EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

                  R Offline
                  R Offline
                  Rock Star
                  wrote on last edited by
                  #8

                  Is there any other alternative for it? So I can bind my detailview on clickiking of select button in gridview.

                  Rock Star

                  1 Reply Last reply
                  0
                  • S Sherin Iranimose

                    1.You can change your code that work with, SelectedIndexChanged of grid view. Dim index As Integer = Generic_DG.SelectedIndex cmd.Parameters.Add("@ProdId", SqlDbType.Int).Value = Generic_DG.DataKeys(index).Value.ToString()

                    EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

                    R Offline
                    R Offline
                    Rock Star
                    wrote on last edited by
                    #9

                    Thanx it is running now but i m getting error as {"Must declare the scalar variable "@ProdId"."} for the code adapt.Fill(DT_DS, "Test") How can I declase avariable @prodID as a scalar variable?

                    Rock Star

                    S 1 Reply Last reply
                    0
                    • R Rock Star

                      Thanx it is running now but i m getting error as {"Must declare the scalar variable "@ProdId"."} for the code adapt.Fill(DT_DS, "Test") How can I declase avariable @prodID as a scalar variable?

                      Rock Star

                      S Offline
                      S Offline
                      Sherin Iranimose
                      wrote on last edited by
                      #10

                      Change the following line. cmd.CommandText = "select * from products where ProdID=@rodID" To cmd.CommandText = "select * from products where ProdID=" & Generic_DG.DataKeys(index).Value.ToString() and delete the following line. cmd.Parameters.Add("@ProdId", SqlDbType.Int).Value = Generic_DG.DataKeys(e.Item.ItemIndex)

                      EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

                      R 1 Reply Last reply
                      0
                      • S Sherin Iranimose

                        Change the following line. cmd.CommandText = "select * from products where ProdID=@rodID" To cmd.CommandText = "select * from products where ProdID=" & Generic_DG.DataKeys(index).Value.ToString() and delete the following line. cmd.Parameters.Add("@ProdId", SqlDbType.Int).Value = Generic_DG.DataKeys(e.Item.ItemIndex)

                        EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

                        R Offline
                        R Offline
                        Rock Star
                        wrote on last edited by
                        #11

                        Hi, Thanx a lot for helping me and giving your precious time to solve this bug. I am trying few more things on it.

                        Rock Star

                        S 1 Reply Last reply
                        0
                        • R Rock Star

                          Hi, Thanx a lot for helping me and giving your precious time to solve this bug. I am trying few more things on it.

                          Rock Star

                          S Offline
                          S Offline
                          Sherin Iranimose
                          wrote on last edited by
                          #12

                          Good Luck :)

                          EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

                          R 1 Reply Last reply
                          0
                          • S Sherin Iranimose

                            Good Luck :)

                            EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

                            R Offline
                            R Offline
                            Rock Star
                            wrote on last edited by
                            #13

                            Hi, I am trying some more operation on the details view. But I am getting some problem in it is specified in the following link http://www.codeproject.com/script/Forums/View.aspx?fid=12076 with the subject line as "Edit the data in a detail view at run time [modified]"

                            Rock Star

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups