Dynamic Datagrid does not fire events.

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Dynamic Datagrid does not fire events.

    I have been working for quite some time on this issue which in theory
    should be quite simple. The problem is that the Cancel and Save
    events are not fired when their respective buttons are clicked.

    I have read several posts which say to put your column generating
    section in the Page_Init section and it will solve the
    problem....however, it hasn't solved mine.

    Can somebody please take a look at this and provide any insight if
    possible?

    Thanks,
    Mark




    Imports System
    Imports System.Data
    Imports System.Data.OleDb

    Public Class DynaGrid

    Inherits System.Web.UI.Page
    Protected WithEvents plcData As
    System.Web.UI.WebControls.PlaceHolder
    Protected WithEvents dgData As New
    System.Web.UI.WebControls.DataGrid()

    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub
    InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form
    Designer
    'Do not modify it using the code editor.
    BindData()
    InitializeComponent()
    End Sub

    #End Region


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

    End Sub


    Sub BindData()
    Dim dbConn As New OleDbConnection()
    dbConn.ConnectionString =
    "provider=sqloledb;Server=SERVERNAME;Database=User ;UID=USERID;PWD=PASSWORD"
    Dim oAdapter As New OleDbDataAdapter("SELECT * FROM T_Group ",
    dbConn)
    Dim dsData As New DataSet()
    oAdapter.Fill(dsData)

    dgData.AllowPaging = False
    dgData.AllowSorting = False
    dgData.AutoGenerateColumns = False
    'dgData.EnableViewState = False

    Dim x As Integer
    For x = 0 To dsData.Tables(0).Columns.Count - 1
    Dim bcCol As New BoundColumn()
    bcCol.HeaderText = dsData.Tables(0).Columns(x).ColumnName
    bcCol.DataField = dsData.Tables(0).Columns(x).Caption
    dgData.Columns.Add(bcCol)
    bcCol = Nothing
    Next

    Dim bcEdit As New EditCommandColumn()
    bcEdit.ButtonType = ButtonColumnType.PushButton
    bcEdit.EditText = "Edit"
    bcEdit.CancelText = "Cancel"
    bcEdit.UpdateText = "Save"
    dgData.Columns.Add(bcEdit)
    bcEdit = Nothing

    dgData.DataSource = dsData.Tables(0)
    dgData.DataBind()

    AddHandler dgData.CancelCommand, AddressOf dgData_cmdCancel
    AddHandler dgData.EditCommand, AddressOf dgData_cmdEdit

    plcData.Controls.Add(dgData)
    End Sub


    Sub dgData_cmdSave(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.DataGridCommandEventArgs )
    dgData.EditItemIndex = -1
    Response.Write(e.CommandName)
    dgData.DataBind()
    End Sub


    Sub dgData_cmdCancel(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.DataGridCommandEventArgs )
    dgData.EditItemIndex = -1
    Response.Write(e.CommandName)
    dgData.DataBind()
    End Sub


    Sub dgData_cmdEdit(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.DataGridCommandEventArgs )
    dgData.EditItemIndex = CInt(e.Item.ItemIndex)
    Response.Write(e.CommandName)
    dgData.DataBind()
    End Sub
    End Class
    Mark Guest

  2. Similar Questions and Discussions

    1. Adding buttons to a datagrid doesn't fire its events
      Hi! I'm adding an asp button to a datagrid on the ItemDataBound event, when the user clicks on this button, I basically remove the button and...
    2. Dynamic Datagrid with TextBoxes Textchanged events wont fire
      Hi, I have the following code (using the VS IDE), which creates a datagrid with template columns (TextBoxes). The grid is bound to a dataview....
    3. Datagrid events refuse to fire (pt 2)
      Further to my earlier post the following events DO fire - ItemDataBound ItemCreated DataBinding Load PreRender UnLoad and the following...
    4. Datagrid events refuse to fire
      I cannot for the life of me get any of my datagrid's events to fire. The grid is within a usercontrol and is static on the page. The grid...
    5. how to fire events of dropdownlist in datagrid
      Hi guys, This is a subtle one. I'm looking for someone who can give me some insight relative to eventsfiring in the codebehind. I have...
  3. #2

    Default Re: Dynamic Datagrid does not fire events.

    Mark,

    Make sure that viewstate is on and that the grid is recreated every page
    load.

    If these two things are done it should be working.

    If you'd like me to take a look at the code post it and I'll see if I can
    get it to work.

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "Mark" <mark_mrachek@yahoo.com> wrote in message
    news:39943a08.0307281935.5824c84c@posting.google.c om...
    > I have been working for quite some time on this issue which in theory
    > should be quite simple. The problem is that the Cancel and Save
    > events are not fired when their respective buttons are clicked.
    >
    > I have read several posts which say to put your column generating
    > section in the Page_Init section and it will solve the
    > problem....however, it hasn't solved mine.
    >
    > Can somebody please take a look at this and provide any insight if
    > possible?
    >
    > Thanks,
    > Mark
    >
    >
    >
    >
    > Imports System
    > Imports System.Data
    > Imports System.Data.OleDb
    >
    > Public Class DynaGrid
    >
    > Inherits System.Web.UI.Page
    > Protected WithEvents plcData As
    > System.Web.UI.WebControls.PlaceHolder
    > Protected WithEvents dgData As New
    > System.Web.UI.WebControls.DataGrid()
    >
    > #Region " Web Form Designer Generated Code "
    >
    > 'This call is required by the Web Form Designer.
    > <System.Diagnostics.DebuggerStepThrough()> Private Sub
    > InitializeComponent()
    >
    > End Sub
    >
    > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Init
    > 'CODEGEN: This method call is required by the Web Form
    > Designer
    > 'Do not modify it using the code editor.
    > BindData()
    > InitializeComponent()
    > End Sub
    >
    > #End Region
    >
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs)
    >
    > End Sub
    >
    >
    > Sub BindData()
    > Dim dbConn As New OleDbConnection()
    > dbConn.ConnectionString =
    >
    "provider=sqloledb;Server=SERVERNAME;Database=User ;UID=USERID;PWD=PASSWORD"
    > Dim oAdapter As New OleDbDataAdapter("SELECT * FROM T_Group ",
    > dbConn)
    > Dim dsData As New DataSet()
    > oAdapter.Fill(dsData)
    >
    > dgData.AllowPaging = False
    > dgData.AllowSorting = False
    > dgData.AutoGenerateColumns = False
    > 'dgData.EnableViewState = False
    >
    > Dim x As Integer
    > For x = 0 To dsData.Tables(0).Columns.Count - 1
    > Dim bcCol As New BoundColumn()
    > bcCol.HeaderText = dsData.Tables(0).Columns(x).ColumnName
    > bcCol.DataField = dsData.Tables(0).Columns(x).Caption
    > dgData.Columns.Add(bcCol)
    > bcCol = Nothing
    > Next
    >
    > Dim bcEdit As New EditCommandColumn()
    > bcEdit.ButtonType = ButtonColumnType.PushButton
    > bcEdit.EditText = "Edit"
    > bcEdit.CancelText = "Cancel"
    > bcEdit.UpdateText = "Save"
    > dgData.Columns.Add(bcEdit)
    > bcEdit = Nothing
    >
    > dgData.DataSource = dsData.Tables(0)
    > dgData.DataBind()
    >
    > AddHandler dgData.CancelCommand, AddressOf dgData_cmdCancel
    > AddHandler dgData.EditCommand, AddressOf dgData_cmdEdit
    >
    > plcData.Controls.Add(dgData)
    > End Sub
    >
    >
    > Sub dgData_cmdSave(ByVal sender As Object, ByVal e As
    > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > dgData.EditItemIndex = -1
    > Response.Write(e.CommandName)
    > dgData.DataBind()
    > End Sub
    >
    >
    > Sub dgData_cmdCancel(ByVal sender As Object, ByVal e As
    > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > dgData.EditItemIndex = -1
    > Response.Write(e.CommandName)
    > dgData.DataBind()
    > End Sub
    >
    >
    > Sub dgData_cmdEdit(ByVal sender As Object, ByVal e As
    > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > dgData.EditItemIndex = CInt(e.Item.ItemIndex)
    > Response.Write(e.CommandName)
    > dgData.DataBind()
    > End Sub
    > End Class

    S. Justin Gengo Guest

  4. #3

    Default Re: Dynamic Datagrid does not fire events.

    I did post the code.


    "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    news:%23YrMg4YVDHA.2156@TK2MSFTNGP11.phx.gbl...
    > Mark,
    >
    > Make sure that viewstate is on and that the grid is recreated every page
    > load.
    >
    > If these two things are done it should be working.
    >
    > If you'd like me to take a look at the code post it and I'll see if I can
    > get it to work.
    >
    > --
    > S. Justin Gengo, MCP
    > Web Developer
    >
    > Free code library at:
    > [url]www.aboutfortunate.com[/url]
    >
    > "Out of chaos comes order."
    > Nietzche
    > "Mark" <mark_mrachek@yahoo.com> wrote in message
    > news:39943a08.0307281935.5824c84c@posting.google.c om...
    > > I have been working for quite some time on this issue which in theory
    > > should be quite simple. The problem is that the Cancel and Save
    > > events are not fired when their respective buttons are clicked.
    > >
    > > I have read several posts which say to put your column generating
    > > section in the Page_Init section and it will solve the
    > > problem....however, it hasn't solved mine.
    > >
    > > Can somebody please take a look at this and provide any insight if
    > > possible?
    > >
    > > Thanks,
    > > Mark
    > >
    > >
    > >
    > >
    > > Imports System
    > > Imports System.Data
    > > Imports System.Data.OleDb
    > >
    > > Public Class DynaGrid
    > >
    > > Inherits System.Web.UI.Page
    > > Protected WithEvents plcData As
    > > System.Web.UI.WebControls.PlaceHolder
    > > Protected WithEvents dgData As New
    > > System.Web.UI.WebControls.DataGrid()
    > >
    > > #Region " Web Form Designer Generated Code "
    > >
    > > 'This call is required by the Web Form Designer.
    > > <System.Diagnostics.DebuggerStepThrough()> Private Sub
    > > InitializeComponent()
    > >
    > > End Sub
    > >
    > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
    > > System.EventArgs) Handles MyBase.Init
    > > 'CODEGEN: This method call is required by the Web Form
    > > Designer
    > > 'Do not modify it using the code editor.
    > > BindData()
    > > InitializeComponent()
    > > End Sub
    > >
    > > #End Region
    > >
    > >
    > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > System.EventArgs)
    > >
    > > End Sub
    > >
    > >
    > > Sub BindData()
    > > Dim dbConn As New OleDbConnection()
    > > dbConn.ConnectionString =
    > >
    >
    "provider=sqloledb;Server=SERVERNAME;Database=User ;UID=USERID;PWD=PASSWORD"
    > > Dim oAdapter As New OleDbDataAdapter("SELECT * FROM T_Group ",
    > > dbConn)
    > > Dim dsData As New DataSet()
    > > oAdapter.Fill(dsData)
    > >
    > > dgData.AllowPaging = False
    > > dgData.AllowSorting = False
    > > dgData.AutoGenerateColumns = False
    > > 'dgData.EnableViewState = False
    > >
    > > Dim x As Integer
    > > For x = 0 To dsData.Tables(0).Columns.Count - 1
    > > Dim bcCol As New BoundColumn()
    > > bcCol.HeaderText = dsData.Tables(0).Columns(x).ColumnName
    > > bcCol.DataField = dsData.Tables(0).Columns(x).Caption
    > > dgData.Columns.Add(bcCol)
    > > bcCol = Nothing
    > > Next
    > >
    > > Dim bcEdit As New EditCommandColumn()
    > > bcEdit.ButtonType = ButtonColumnType.PushButton
    > > bcEdit.EditText = "Edit"
    > > bcEdit.CancelText = "Cancel"
    > > bcEdit.UpdateText = "Save"
    > > dgData.Columns.Add(bcEdit)
    > > bcEdit = Nothing
    > >
    > > dgData.DataSource = dsData.Tables(0)
    > > dgData.DataBind()
    > >
    > > AddHandler dgData.CancelCommand, AddressOf dgData_cmdCancel
    > > AddHandler dgData.EditCommand, AddressOf dgData_cmdEdit
    > >
    > > plcData.Controls.Add(dgData)
    > > End Sub
    > >
    > >
    > > Sub dgData_cmdSave(ByVal sender As Object, ByVal e As
    > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > dgData.EditItemIndex = -1
    > > Response.Write(e.CommandName)
    > > dgData.DataBind()
    > > End Sub
    > >
    > >
    > > Sub dgData_cmdCancel(ByVal sender As Object, ByVal e As
    > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > dgData.EditItemIndex = -1
    > > Response.Write(e.CommandName)
    > > dgData.DataBind()
    > > End Sub
    > >
    > >
    > > Sub dgData_cmdEdit(ByVal sender As Object, ByVal e As
    > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > dgData.EditItemIndex = CInt(e.Item.ItemIndex)
    > > Response.Write(e.CommandName)
    > > dgData.DataBind()
    > > End Sub
    > > End Class
    >
    >

    Mark Guest

  5. #4

    Default Re: Dynamic Datagrid does not fire events.

    Mark,

    Sorry I just wasn't specific. I'll chalk up my lack of presenting a logical
    request to the amount of sleep I had at the time. :)

    Could you please also post the designer's code. Then I can recreate the
    entire page and take a look.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "Mark" <mark_mrachek@yahoo.com> wrote in message
    news:ul8uwqZVDHA.1984@TK2MSFTNGP11.phx.gbl...
    > I did post the code.
    >
    >
    > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    > news:%23YrMg4YVDHA.2156@TK2MSFTNGP11.phx.gbl...
    > > Mark,
    > >
    > > Make sure that viewstate is on and that the grid is recreated every page
    > > load.
    > >
    > > If these two things are done it should be working.
    > >
    > > If you'd like me to take a look at the code post it and I'll see if I
    can
    > > get it to work.
    > >
    > > --
    > > S. Justin Gengo, MCP
    > > Web Developer
    > >
    > > Free code library at:
    > > [url]www.aboutfortunate.com[/url]
    > >
    > > "Out of chaos comes order."
    > > Nietzche
    > > "Mark" <mark_mrachek@yahoo.com> wrote in message
    > > news:39943a08.0307281935.5824c84c@posting.google.c om...
    > > > I have been working for quite some time on this issue which in theory
    > > > should be quite simple. The problem is that the Cancel and Save
    > > > events are not fired when their respective buttons are clicked.
    > > >
    > > > I have read several posts which say to put your column generating
    > > > section in the Page_Init section and it will solve the
    > > > problem....however, it hasn't solved mine.
    > > >
    > > > Can somebody please take a look at this and provide any insight if
    > > > possible?
    > > >
    > > > Thanks,
    > > > Mark
    > > >
    > > >
    > > >
    > > >
    > > > Imports System
    > > > Imports System.Data
    > > > Imports System.Data.OleDb
    > > >
    > > > Public Class DynaGrid
    > > >
    > > > Inherits System.Web.UI.Page
    > > > Protected WithEvents plcData As
    > > > System.Web.UI.WebControls.PlaceHolder
    > > > Protected WithEvents dgData As New
    > > > System.Web.UI.WebControls.DataGrid()
    > > >
    > > > #Region " Web Form Designer Generated Code "
    > > >
    > > > 'This call is required by the Web Form Designer.
    > > > <System.Diagnostics.DebuggerStepThrough()> Private Sub
    > > > InitializeComponent()
    > > >
    > > > End Sub
    > > >
    > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
    > > > System.EventArgs) Handles MyBase.Init
    > > > 'CODEGEN: This method call is required by the Web Form
    > > > Designer
    > > > 'Do not modify it using the code editor.
    > > > BindData()
    > > > InitializeComponent()
    > > > End Sub
    > > >
    > > > #End Region
    > > >
    > > >
    > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > > System.EventArgs)
    > > >
    > > > End Sub
    > > >
    > > >
    > > > Sub BindData()
    > > > Dim dbConn As New OleDbConnection()
    > > > dbConn.ConnectionString =
    > > >
    > >
    >
    "provider=sqloledb;Server=SERVERNAME;Database=User ;UID=USERID;PWD=PASSWORD"
    > > > Dim oAdapter As New OleDbDataAdapter("SELECT * FROM T_Group ",
    > > > dbConn)
    > > > Dim dsData As New DataSet()
    > > > oAdapter.Fill(dsData)
    > > >
    > > > dgData.AllowPaging = False
    > > > dgData.AllowSorting = False
    > > > dgData.AutoGenerateColumns = False
    > > > 'dgData.EnableViewState = False
    > > >
    > > > Dim x As Integer
    > > > For x = 0 To dsData.Tables(0).Columns.Count - 1
    > > > Dim bcCol As New BoundColumn()
    > > > bcCol.HeaderText = dsData.Tables(0).Columns(x).ColumnName
    > > > bcCol.DataField = dsData.Tables(0).Columns(x).Caption
    > > > dgData.Columns.Add(bcCol)
    > > > bcCol = Nothing
    > > > Next
    > > >
    > > > Dim bcEdit As New EditCommandColumn()
    > > > bcEdit.ButtonType = ButtonColumnType.PushButton
    > > > bcEdit.EditText = "Edit"
    > > > bcEdit.CancelText = "Cancel"
    > > > bcEdit.UpdateText = "Save"
    > > > dgData.Columns.Add(bcEdit)
    > > > bcEdit = Nothing
    > > >
    > > > dgData.DataSource = dsData.Tables(0)
    > > > dgData.DataBind()
    > > >
    > > > AddHandler dgData.CancelCommand, AddressOf dgData_cmdCancel
    > > > AddHandler dgData.EditCommand, AddressOf dgData_cmdEdit
    > > >
    > > > plcData.Controls.Add(dgData)
    > > > End Sub
    > > >
    > > >
    > > > Sub dgData_cmdSave(ByVal sender As Object, ByVal e As
    > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > dgData.EditItemIndex = -1
    > > > Response.Write(e.CommandName)
    > > > dgData.DataBind()
    > > > End Sub
    > > >
    > > >
    > > > Sub dgData_cmdCancel(ByVal sender As Object, ByVal e As
    > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > dgData.EditItemIndex = -1
    > > > Response.Write(e.CommandName)
    > > > dgData.DataBind()
    > > > End Sub
    > > >
    > > >
    > > > Sub dgData_cmdEdit(ByVal sender As Object, ByVal e As
    > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > dgData.EditItemIndex = CInt(e.Item.ItemIndex)
    > > > Response.Write(e.CommandName)
    > > > dgData.DataBind()
    > > > End Sub
    > > > End Class
    > >
    > >
    >
    >

    S. Justin Gengo Guest

  6. #5

    Default Re: Dynamic Datagrid does not fire events.

    Justin,

    I appreciate you taking a look at this.

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="DynaGrid.aspx.vb"
    Inherits="MMDG.DynaGrid"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>DynaGrid</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
    <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema"
    content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:PlaceHolder ID="plcData" Runat="server"></asp:PlaceHolder>
    </form>
    </body>
    </HTML>



    "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    news:uJZqWRdVDHA.1984@TK2MSFTNGP11.phx.gbl...
    > Mark,
    >
    > Sorry I just wasn't specific. I'll chalk up my lack of presenting a
    logical
    > request to the amount of sleep I had at the time. :)
    >
    > Could you please also post the designer's code. Then I can recreate the
    > entire page and take a look.
    >
    > Sincerely,
    >
    > --
    > S. Justin Gengo, MCP
    > Web Developer
    >
    > Free code library at:
    > [url]www.aboutfortunate.com[/url]
    >
    > "Out of chaos comes order."
    > Nietzche
    > "Mark" <mark_mrachek@yahoo.com> wrote in message
    > news:ul8uwqZVDHA.1984@TK2MSFTNGP11.phx.gbl...
    > > I did post the code.
    > >
    > >
    > > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    > > news:%23YrMg4YVDHA.2156@TK2MSFTNGP11.phx.gbl...
    > > > Mark,
    > > >
    > > > Make sure that viewstate is on and that the grid is recreated every
    page
    > > > load.
    > > >
    > > > If these two things are done it should be working.
    > > >
    > > > If you'd like me to take a look at the code post it and I'll see if I
    > can
    > > > get it to work.
    > > >
    > > > --
    > > > S. Justin Gengo, MCP
    > > > Web Developer
    > > >
    > > > Free code library at:
    > > > [url]www.aboutfortunate.com[/url]
    > > >
    > > > "Out of chaos comes order."
    > > > Nietzche
    > > > "Mark" <mark_mrachek@yahoo.com> wrote in message
    > > > news:39943a08.0307281935.5824c84c@posting.google.c om...
    > > > > I have been working for quite some time on this issue which in
    theory
    > > > > should be quite simple. The problem is that the Cancel and Save
    > > > > events are not fired when their respective buttons are clicked.
    > > > >
    > > > > I have read several posts which say to put your column generating
    > > > > section in the Page_Init section and it will solve the
    > > > > problem....however, it hasn't solved mine.
    > > > >
    > > > > Can somebody please take a look at this and provide any insight if
    > > > > possible?
    > > > >
    > > > > Thanks,
    > > > > Mark
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > Imports System
    > > > > Imports System.Data
    > > > > Imports System.Data.OleDb
    > > > >
    > > > > Public Class DynaGrid
    > > > >
    > > > > Inherits System.Web.UI.Page
    > > > > Protected WithEvents plcData As
    > > > > System.Web.UI.WebControls.PlaceHolder
    > > > > Protected WithEvents dgData As New
    > > > > System.Web.UI.WebControls.DataGrid()
    > > > >
    > > > > #Region " Web Form Designer Generated Code "
    > > > >
    > > > > 'This call is required by the Web Form Designer.
    > > > > <System.Diagnostics.DebuggerStepThrough()> Private Sub
    > > > > InitializeComponent()
    > > > >
    > > > > End Sub
    > > > >
    > > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
    > > > > System.EventArgs) Handles MyBase.Init
    > > > > 'CODEGEN: This method call is required by the Web Form
    > > > > Designer
    > > > > 'Do not modify it using the code editor.
    > > > > BindData()
    > > > > InitializeComponent()
    > > > > End Sub
    > > > >
    > > > > #End Region
    > > > >
    > > > >
    > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > > > System.EventArgs)
    > > > >
    > > > > End Sub
    > > > >
    > > > >
    > > > > Sub BindData()
    > > > > Dim dbConn As New OleDbConnection()
    > > > > dbConn.ConnectionString =
    > > > >
    > > >
    > >
    >
    "provider=sqloledb;Server=SERVERNAME;Database=User ;UID=USERID;PWD=PASSWORD"
    > > > > Dim oAdapter As New OleDbDataAdapter("SELECT * FROM T_Group
    ",
    > > > > dbConn)
    > > > > Dim dsData As New DataSet()
    > > > > oAdapter.Fill(dsData)
    > > > >
    > > > > dgData.AllowPaging = False
    > > > > dgData.AllowSorting = False
    > > > > dgData.AutoGenerateColumns = False
    > > > > 'dgData.EnableViewState = False
    > > > >
    > > > > Dim x As Integer
    > > > > For x = 0 To dsData.Tables(0).Columns.Count - 1
    > > > > Dim bcCol As New BoundColumn()
    > > > > bcCol.HeaderText =
    dsData.Tables(0).Columns(x).ColumnName
    > > > > bcCol.DataField = dsData.Tables(0).Columns(x).Caption
    > > > > dgData.Columns.Add(bcCol)
    > > > > bcCol = Nothing
    > > > > Next
    > > > >
    > > > > Dim bcEdit As New EditCommandColumn()
    > > > > bcEdit.ButtonType = ButtonColumnType.PushButton
    > > > > bcEdit.EditText = "Edit"
    > > > > bcEdit.CancelText = "Cancel"
    > > > > bcEdit.UpdateText = "Save"
    > > > > dgData.Columns.Add(bcEdit)
    > > > > bcEdit = Nothing
    > > > >
    > > > > dgData.DataSource = dsData.Tables(0)
    > > > > dgData.DataBind()
    > > > >
    > > > > AddHandler dgData.CancelCommand, AddressOf dgData_cmdCancel
    > > > > AddHandler dgData.EditCommand, AddressOf dgData_cmdEdit
    > > > >
    > > > > plcData.Controls.Add(dgData)
    > > > > End Sub
    > > > >
    > > > >
    > > > > Sub dgData_cmdSave(ByVal sender As Object, ByVal e As
    > > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > > dgData.EditItemIndex = -1
    > > > > Response.Write(e.CommandName)
    > > > > dgData.DataBind()
    > > > > End Sub
    > > > >
    > > > >
    > > > > Sub dgData_cmdCancel(ByVal sender As Object, ByVal e As
    > > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > > dgData.EditItemIndex = -1
    > > > > Response.Write(e.CommandName)
    > > > > dgData.DataBind()
    > > > > End Sub
    > > > >
    > > > >
    > > > > Sub dgData_cmdEdit(ByVal sender As Object, ByVal e As
    > > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > > dgData.EditItemIndex = CInt(e.Item.ItemIndex)
    > > > > Response.Write(e.CommandName)
    > > > > dgData.DataBind()
    > > > > End Sub
    > > > > End Class
    > > >
    > > >
    > >
    > >
    >
    >

    Mark Guest

  7. #6

    Default Re: Dynamic Datagrid does not fire events.

    Mark,

    It took a little while of playing to get it to work, but as it turns out all
    I did was move the Call BindData() statement which is in the Page_Init sub
    so that it is below the call to: InitializeComponent

    (I should have seen it without recreating everything!)

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Init

    'CODEGEN: This method call is required by the Web Form Designer

    'Do not modify it using the code editor.

    InitializeComponent()

    Call BindData()

    End Sub

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "Mark" <mark_mrachek@yahoo.com> wrote in message
    news:%23BoQp2gVDHA.1816@TK2MSFTNGP09.phx.gbl...
    > Justin,
    >
    > I appreciate you taking a look at this.
    >
    > <%@ Page Language="vb" AutoEventWireup="false"
    Codebehind="DynaGrid.aspx.vb"
    > Inherits="MMDG.DynaGrid"%>
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    > <HTML>
    > <HEAD>
    > <title>DynaGrid</title>
    > <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
    > <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
    > <meta name="vs_defaultClientScript" content="JavaScript">
    > <meta name="vs_targetSchema"
    > content="http://schemas.microsoft.com/intellisense/ie5">
    > </HEAD>
    > <body MS_POSITIONING="GridLayout">
    > <form id="Form1" method="post" runat="server">
    > <asp:PlaceHolder ID="plcData" Runat="server"></asp:PlaceHolder>
    > </form>
    > </body>
    > </HTML>
    >
    >
    >
    > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    > news:uJZqWRdVDHA.1984@TK2MSFTNGP11.phx.gbl...
    > > Mark,
    > >
    > > Sorry I just wasn't specific. I'll chalk up my lack of presenting a
    > logical
    > > request to the amount of sleep I had at the time. :)
    > >
    > > Could you please also post the designer's code. Then I can recreate the
    > > entire page and take a look.
    > >
    > > Sincerely,
    > >
    > > --
    > > S. Justin Gengo, MCP
    > > Web Developer
    > >
    > > Free code library at:
    > > [url]www.aboutfortunate.com[/url]
    > >
    > > "Out of chaos comes order."
    > > Nietzche
    > > "Mark" <mark_mrachek@yahoo.com> wrote in message
    > > news:ul8uwqZVDHA.1984@TK2MSFTNGP11.phx.gbl...
    > > > I did post the code.
    > > >
    > > >
    > > > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    > > > news:%23YrMg4YVDHA.2156@TK2MSFTNGP11.phx.gbl...
    > > > > Mark,
    > > > >
    > > > > Make sure that viewstate is on and that the grid is recreated every
    > page
    > > > > load.
    > > > >
    > > > > If these two things are done it should be working.
    > > > >
    > > > > If you'd like me to take a look at the code post it and I'll see if
    I
    > > can
    > > > > get it to work.
    > > > >
    > > > > --
    > > > > S. Justin Gengo, MCP
    > > > > Web Developer
    > > > >
    > > > > Free code library at:
    > > > > [url]www.aboutfortunate.com[/url]
    > > > >
    > > > > "Out of chaos comes order."
    > > > > Nietzche
    > > > > "Mark" <mark_mrachek@yahoo.com> wrote in message
    > > > > news:39943a08.0307281935.5824c84c@posting.google.c om...
    > > > > > I have been working for quite some time on this issue which in
    > theory
    > > > > > should be quite simple. The problem is that the Cancel and Save
    > > > > > events are not fired when their respective buttons are clicked.
    > > > > >
    > > > > > I have read several posts which say to put your column generating
    > > > > > section in the Page_Init section and it will solve the
    > > > > > problem....however, it hasn't solved mine.
    > > > > >
    > > > > > Can somebody please take a look at this and provide any insight if
    > > > > > possible?
    > > > > >
    > > > > > Thanks,
    > > > > > Mark
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > > Imports System
    > > > > > Imports System.Data
    > > > > > Imports System.Data.OleDb
    > > > > >
    > > > > > Public Class DynaGrid
    > > > > >
    > > > > > Inherits System.Web.UI.Page
    > > > > > Protected WithEvents plcData As
    > > > > > System.Web.UI.WebControls.PlaceHolder
    > > > > > Protected WithEvents dgData As New
    > > > > > System.Web.UI.WebControls.DataGrid()
    > > > > >
    > > > > > #Region " Web Form Designer Generated Code "
    > > > > >
    > > > > > 'This call is required by the Web Form Designer.
    > > > > > <System.Diagnostics.DebuggerStepThrough()> Private Sub
    > > > > > InitializeComponent()
    > > > > >
    > > > > > End Sub
    > > > > >
    > > > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e
    As
    > > > > > System.EventArgs) Handles MyBase.Init
    > > > > > 'CODEGEN: This method call is required by the Web Form
    > > > > > Designer
    > > > > > 'Do not modify it using the code editor.
    > > > > > BindData()
    > > > > > InitializeComponent()
    > > > > > End Sub
    > > > > >
    > > > > > #End Region
    > > > > >
    > > > > >
    > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e
    As
    > > > > > System.EventArgs)
    > > > > >
    > > > > > End Sub
    > > > > >
    > > > > >
    > > > > > Sub BindData()
    > > > > > Dim dbConn As New OleDbConnection()
    > > > > > dbConn.ConnectionString =
    > > > > >
    > > > >
    > > >
    > >
    >
    "provider=sqloledb;Server=SERVERNAME;Database=User ;UID=USERID;PWD=PASSWORD"
    > > > > > Dim oAdapter As New OleDbDataAdapter("SELECT * FROM
    T_Group
    > ",
    > > > > > dbConn)
    > > > > > Dim dsData As New DataSet()
    > > > > > oAdapter.Fill(dsData)
    > > > > >
    > > > > > dgData.AllowPaging = False
    > > > > > dgData.AllowSorting = False
    > > > > > dgData.AutoGenerateColumns = False
    > > > > > 'dgData.EnableViewState = False
    > > > > >
    > > > > > Dim x As Integer
    > > > > > For x = 0 To dsData.Tables(0).Columns.Count - 1
    > > > > > Dim bcCol As New BoundColumn()
    > > > > > bcCol.HeaderText =
    > dsData.Tables(0).Columns(x).ColumnName
    > > > > > bcCol.DataField = dsData.Tables(0).Columns(x).Caption
    > > > > > dgData.Columns.Add(bcCol)
    > > > > > bcCol = Nothing
    > > > > > Next
    > > > > >
    > > > > > Dim bcEdit As New EditCommandColumn()
    > > > > > bcEdit.ButtonType = ButtonColumnType.PushButton
    > > > > > bcEdit.EditText = "Edit"
    > > > > > bcEdit.CancelText = "Cancel"
    > > > > > bcEdit.UpdateText = "Save"
    > > > > > dgData.Columns.Add(bcEdit)
    > > > > > bcEdit = Nothing
    > > > > >
    > > > > > dgData.DataSource = dsData.Tables(0)
    > > > > > dgData.DataBind()
    > > > > >
    > > > > > AddHandler dgData.CancelCommand, AddressOf
    dgData_cmdCancel
    > > > > > AddHandler dgData.EditCommand, AddressOf dgData_cmdEdit
    > > > > >
    > > > > > plcData.Controls.Add(dgData)
    > > > > > End Sub
    > > > > >
    > > > > >
    > > > > > Sub dgData_cmdSave(ByVal sender As Object, ByVal e As
    > > > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > > > dgData.EditItemIndex = -1
    > > > > > Response.Write(e.CommandName)
    > > > > > dgData.DataBind()
    > > > > > End Sub
    > > > > >
    > > > > >
    > > > > > Sub dgData_cmdCancel(ByVal sender As Object, ByVal e As
    > > > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > > > dgData.EditItemIndex = -1
    > > > > > Response.Write(e.CommandName)
    > > > > > dgData.DataBind()
    > > > > > End Sub
    > > > > >
    > > > > >
    > > > > > Sub dgData_cmdEdit(ByVal sender As Object, ByVal e As
    > > > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > > > dgData.EditItemIndex = CInt(e.Item.ItemIndex)
    > > > > > Response.Write(e.CommandName)
    > > > > > dgData.DataBind()
    > > > > > End Sub
    > > > > > End Class
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    S. Justin Gengo Guest

  8. #7

    Default Re: Dynamic Datagrid does not fire events.

    Mark,

    Everything seems to be working for me. I would suggest however that you look
    into creating your datagrid in a user control and add the user control to
    the page dynamically. That way a lot of the page rendering and post back
    event handlers are created for you.

    Take a look at the code I offer on my website: [url]www.aboutfortunate.com[/url] on
    placing user control's on a page dynamically. It should get you started.

    Just search for: Dynamic User Controls

    I hope this helps.

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "Mark" <mark_mrachek@yahoo.com> wrote in message
    news:e4rKDiwVDHA.2352@TK2MSFTNGP12.phx.gbl...
    > Justin,
    >
    > Thanks for looking at this.
    >
    > How many times does the dgData_cmdEdit event get called when you request
    the
    > page? Every time I request the page, this event runs twice (I don't have
    > Zone Alarm). If I remove the AddHandler section, then it only runs once.
    > It's as though the AddHandler actually forces the event to run when it's
    > created.
    >
    > I have never been able to ge the Save or Cancel events to fire under any
    > circumstance.
    >
    > Another issue I have found: if you click on the edit button for the first
    > item in the grid, it goes into edit mode. If you then click on the edit
    > button for the second item in the list it wil go into edit mode. Then, if
    > you go back to the first item and click on Edit, it will not go into edit
    > mode (edit mode stays on the second line).
    >
    > I originally thought this was due to viewstate for the dg, but even
    > disabling it did not work.
    >
    > Thanks,
    > MM
    >
    >
    > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    > news:eCYy$ptVDHA.2344@TK2MSFTNGP10.phx.gbl...
    > > Mark,
    > >
    > > It took a little while of playing to get it to work, but as it turns out
    > all
    > > I did was move the Call BindData() statement which is in the Page_Init
    sub
    > > so that it is below the call to: InitializeComponent
    > >
    > > (I should have seen it without recreating everything!)
    > >
    > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
    > > System.EventArgs) Handles MyBase.Init
    > >
    > > 'CODEGEN: This method call is required by the Web Form Designer
    > >
    > > 'Do not modify it using the code editor.
    > >
    > > InitializeComponent()
    > >
    > > Call BindData()
    > >
    > > End Sub
    > >
    > > Sincerely,
    > >
    > > --
    > > S. Justin Gengo, MCP
    > > Web Developer
    > >
    > > Free code library at:
    > > [url]www.aboutfortunate.com[/url]
    > >
    > > "Out of chaos comes order."
    > > Nietzche
    > > "Mark" <mark_mrachek@yahoo.com> wrote in message
    > > news:%23BoQp2gVDHA.1816@TK2MSFTNGP09.phx.gbl...
    > > > Justin,
    > > >
    > > > I appreciate you taking a look at this.
    > > >
    > > > <%@ Page Language="vb" AutoEventWireup="false"
    > > Codebehind="DynaGrid.aspx.vb"
    > > > Inherits="MMDG.DynaGrid"%>
    > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    > > > <HTML>
    > > > <HEAD>
    > > > <title>DynaGrid</title>
    > > > <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
    > > > <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
    > > > <meta name="vs_defaultClientScript" content="JavaScript">
    > > > <meta name="vs_targetSchema"
    > > > content="http://schemas.microsoft.com/intellisense/ie5">
    > > > </HEAD>
    > > > <body MS_POSITIONING="GridLayout">
    > > > <form id="Form1" method="post" runat="server">
    > > > <asp:PlaceHolder ID="plcData" Runat="server"></asp:PlaceHolder>
    > > > </form>
    > > > </body>
    > > > </HTML>
    > > >
    > > >
    > > >
    > > > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    > > > news:uJZqWRdVDHA.1984@TK2MSFTNGP11.phx.gbl...
    > > > > Mark,
    > > > >
    > > > > Sorry I just wasn't specific. I'll chalk up my lack of presenting a
    > > > logical
    > > > > request to the amount of sleep I had at the time. :)
    > > > >
    > > > > Could you please also post the designer's code. Then I can recreate
    > the
    > > > > entire page and take a look.
    > > > >
    > > > > Sincerely,
    > > > >
    > > > > --
    > > > > S. Justin Gengo, MCP
    > > > > Web Developer
    > > > >
    > > > > Free code library at:
    > > > > [url]www.aboutfortunate.com[/url]
    > > > >
    > > > > "Out of chaos comes order."
    > > > > Nietzche
    > > > > "Mark" <mark_mrachek@yahoo.com> wrote in message
    > > > > news:ul8uwqZVDHA.1984@TK2MSFTNGP11.phx.gbl...
    > > > > > I did post the code.
    > > > > >
    > > > > >
    > > > > > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    > > > > > news:%23YrMg4YVDHA.2156@TK2MSFTNGP11.phx.gbl...
    > > > > > > Mark,
    > > > > > >
    > > > > > > Make sure that viewstate is on and that the grid is recreated
    > every
    > > > page
    > > > > > > load.
    > > > > > >
    > > > > > > If these two things are done it should be working.
    > > > > > >
    > > > > > > If you'd like me to take a look at the code post it and I'll see
    > if
    > > I
    > > > > can
    > > > > > > get it to work.
    > > > > > >
    > > > > > > --
    > > > > > > S. Justin Gengo, MCP
    > > > > > > Web Developer
    > > > > > >
    > > > > > > Free code library at:
    > > > > > > [url]www.aboutfortunate.com[/url]
    > > > > > >
    > > > > > > "Out of chaos comes order."
    > > > > > > Nietzche
    > > > > > > "Mark" <mark_mrachek@yahoo.com> wrote in message
    > > > > > > news:39943a08.0307281935.5824c84c@posting.google.c om...
    > > > > > > > I have been working for quite some time on this issue which in
    > > > theory
    > > > > > > > should be quite simple. The problem is that the Cancel and
    Save
    > > > > > > > events are not fired when their respective buttons are
    clicked.
    > > > > > > >
    > > > > > > > I have read several posts which say to put your column
    > generating
    > > > > > > > section in the Page_Init section and it will solve the
    > > > > > > > problem....however, it hasn't solved mine.
    > > > > > > >
    > > > > > > > Can somebody please take a look at this and provide any
    insight
    > if
    > > > > > > > possible?
    > > > > > > >
    > > > > > > > Thanks,
    > > > > > > > Mark
    > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > > > Imports System
    > > > > > > > Imports System.Data
    > > > > > > > Imports System.Data.OleDb
    > > > > > > >
    > > > > > > > Public Class DynaGrid
    > > > > > > >
    > > > > > > > Inherits System.Web.UI.Page
    > > > > > > > Protected WithEvents plcData As
    > > > > > > > System.Web.UI.WebControls.PlaceHolder
    > > > > > > > Protected WithEvents dgData As New
    > > > > > > > System.Web.UI.WebControls.DataGrid()
    > > > > > > >
    > > > > > > > #Region " Web Form Designer Generated Code "
    > > > > > > >
    > > > > > > > 'This call is required by the Web Form Designer.
    > > > > > > > <System.Diagnostics.DebuggerStepThrough()> Private Sub
    > > > > > > > InitializeComponent()
    > > > > > > >
    > > > > > > > End Sub
    > > > > > > >
    > > > > > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal
    e
    > > As
    > > > > > > > System.EventArgs) Handles MyBase.Init
    > > > > > > > 'CODEGEN: This method call is required by the Web Form
    > > > > > > > Designer
    > > > > > > > 'Do not modify it using the code editor.
    > > > > > > > BindData()
    > > > > > > > InitializeComponent()
    > > > > > > > End Sub
    > > > > > > >
    > > > > > > > #End Region
    > > > > > > >
    > > > > > > >
    > > > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal
    e
    > > As
    > > > > > > > System.EventArgs)
    > > > > > > >
    > > > > > > > End Sub
    > > > > > > >
    > > > > > > >
    > > > > > > > Sub BindData()
    > > > > > > > Dim dbConn As New OleDbConnection()
    > > > > > > > dbConn.ConnectionString =
    > > > > > > >
    > > > > > >
    > > > > >
    > > > >
    > > >
    > >
    >
    "provider=sqloledb;Server=SERVERNAME;Database=User ;UID=USERID;PWD=PASSWORD"
    > > > > > > > Dim oAdapter As New OleDbDataAdapter("SELECT * FROM
    > > T_Group
    > > > ",
    > > > > > > > dbConn)
    > > > > > > > Dim dsData As New DataSet()
    > > > > > > > oAdapter.Fill(dsData)
    > > > > > > >
    > > > > > > > dgData.AllowPaging = False
    > > > > > > > dgData.AllowSorting = False
    > > > > > > > dgData.AutoGenerateColumns = False
    > > > > > > > 'dgData.EnableViewState = False
    > > > > > > >
    > > > > > > > Dim x As Integer
    > > > > > > > For x = 0 To dsData.Tables(0).Columns.Count - 1
    > > > > > > > Dim bcCol As New BoundColumn()
    > > > > > > > bcCol.HeaderText =
    > > > dsData.Tables(0).Columns(x).ColumnName
    > > > > > > > bcCol.DataField =
    > dsData.Tables(0).Columns(x).Caption
    > > > > > > > dgData.Columns.Add(bcCol)
    > > > > > > > bcCol = Nothing
    > > > > > > > Next
    > > > > > > >
    > > > > > > > Dim bcEdit As New EditCommandColumn()
    > > > > > > > bcEdit.ButtonType = ButtonColumnType.PushButton
    > > > > > > > bcEdit.EditText = "Edit"
    > > > > > > > bcEdit.CancelText = "Cancel"
    > > > > > > > bcEdit.UpdateText = "Save"
    > > > > > > > dgData.Columns.Add(bcEdit)
    > > > > > > > bcEdit = Nothing
    > > > > > > >
    > > > > > > > dgData.DataSource = dsData.Tables(0)
    > > > > > > > dgData.DataBind()
    > > > > > > >
    > > > > > > > AddHandler dgData.CancelCommand, AddressOf
    > > dgData_cmdCancel
    > > > > > > > AddHandler dgData.EditCommand, AddressOf
    dgData_cmdEdit
    > > > > > > >
    > > > > > > > plcData.Controls.Add(dgData)
    > > > > > > > End Sub
    > > > > > > >
    > > > > > > >
    > > > > > > > Sub dgData_cmdSave(ByVal sender As Object, ByVal e As
    > > > > > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > > > > > dgData.EditItemIndex = -1
    > > > > > > > Response.Write(e.CommandName)
    > > > > > > > dgData.DataBind()
    > > > > > > > End Sub
    > > > > > > >
    > > > > > > >
    > > > > > > > Sub dgData_cmdCancel(ByVal sender As Object, ByVal e As
    > > > > > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > > > > > dgData.EditItemIndex = -1
    > > > > > > > Response.Write(e.CommandName)
    > > > > > > > dgData.DataBind()
    > > > > > > > End Sub
    > > > > > > >
    > > > > > > >
    > > > > > > > Sub dgData_cmdEdit(ByVal sender As Object, ByVal e As
    > > > > > > > System.Web.UI.WebControls.DataGridCommandEventArgs )
    > > > > > > > dgData.EditItemIndex = CInt(e.Item.ItemIndex)
    > > > > > > > Response.Write(e.CommandName)
    > > > > > > > dgData.DataBind()
    > > > > > > > End Sub
    > > > > > > > End Class
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    S. Justin Gengo Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139