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. How to create events for dynamically generated datagrid

How to create events for dynamically generated datagrid

Scheduled Pinned Locked Moved ASP.NET
databasecsharpasp-netsql-server
4 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.
  • B Offline
    B Offline
    BalasahebK
    wrote on last edited by
    #1

    I don't want to drag and drop datagrid from tools, but I just want to create it during runtime using vb.net syntax on asp.net page using asp.net 1.1 version. ASP.NET 2003. dim dg as datagrid then adding bound column by creating its object. It is fine upto this level. Even it gets implemented. But I couldn't find any article that helps in generating events for RUNTIME GENERATED DATAGRID. So can anybody help in this regard. I would like to implement events like PageIndexChanged, SortCommand, ItemDataBound. So please help in this regard. Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000

    L 1 Reply Last reply
    0
    • B BalasahebK

      I don't want to drag and drop datagrid from tools, but I just want to create it during runtime using vb.net syntax on asp.net page using asp.net 1.1 version. ASP.NET 2003. dim dg as datagrid then adding bound column by creating its object. It is fine upto this level. Even it gets implemented. But I couldn't find any article that helps in generating events for RUNTIME GENERATED DATAGRID. So can anybody help in this regard. I would like to implement events like PageIndexChanged, SortCommand, ItemDataBound. So please help in this regard. Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000

      L Offline
      L Offline
      l0kke
      wrote on last edited by
      #2

      I'm using VS.NET 2005, but it should be similar: DataGrid myDataGrid = new DataGrid(); myDataGrid.PageIndexChanged += new DataGridPageChangedEventHandler(myDataGrid_PageIndexChanged); ... protected void myDataGrid_PageIndexChanged(object sender, EventArgs e) { .... }

      B 1 Reply Last reply
      0
      • L l0kke

        I'm using VS.NET 2005, but it should be similar: DataGrid myDataGrid = new DataGrid(); myDataGrid.PageIndexChanged += new DataGridPageChangedEventHandler(myDataGrid_PageIndexChanged); ... protected void myDataGrid_PageIndexChanged(object sender, EventArgs e) { .... }

        B Offline
        B Offline
        BalasahebK
        wrote on last edited by
        #3

        Thanks for ur help But ur code doesn't work after converting in vb.net means like this dim dg as new datagrid() dg.pageindexchanged event is not available. Does I need to import some file? Wht should I do now? I think I need to add RaiseEvent as event bcoz when I write dg.pageindexchanged It gives me error saying 'dg.pageindexchanged is a event and cannot be called directly. Use RaiseEvent statement' Can u suggent me on this event?:) Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000 -- modified at 12:37 Friday 23rd June, 2006

        L 1 Reply Last reply
        0
        • B BalasahebK

          Thanks for ur help But ur code doesn't work after converting in vb.net means like this dim dg as new datagrid() dg.pageindexchanged event is not available. Does I need to import some file? Wht should I do now? I think I need to add RaiseEvent as event bcoz when I write dg.pageindexchanged It gives me error saying 'dg.pageindexchanged is a event and cannot be called directly. Use RaiseEvent statement' Can u suggent me on this event?:) Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000 -- modified at 12:37 Friday 23rd June, 2006

          L Offline
          L Offline
          l0kke
          wrote on last edited by
          #4

          Sorry, I didn't notice you are using vb. I don't know exact syntax for handling events in vb, but this is what I found on msdn:[^] '---------------------------------------------- Visual Basic (Usage) Dim instance As DataGrid Dim handler As DataGridPageChangedEventHandler AddHandler instance.PageIndexChanged, handler '---------------------------------------------- This code is not supposed to raise event, but assign event handler to event. Event is raised automaticly when you change page of datagrid by clicking it. I hope it helps -- modified at 8:44 Sunday 25th June, 2006

          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