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. Passing value to javascript function "onload" event from datagrid

Passing value to javascript function "onload" event from datagrid

Scheduled Pinned Locked Moved ASP.NET
javascripthelp
2 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.
  • D Offline
    D Offline
    Dhruvil
    wrote on last edited by
    #1

    Hi all, Very much confuse with this. I have a datagrid, and i am able to pass the value to javascript function through "onclick" event as below: e.item.attributes.add("onclick","javascript:myfunction('"+value1+"');"); but, when i am trying to pass the value of the first row on datagrid through "onload" event as below: dg.Items[0].Attributes.Add("onload","javascript:myfunction('"+value1+"');"); it's not passing the value. I have to use onload event, so i can display default value th' javascript function. Any help will be appreciated. Thanks, NIKI

    M 1 Reply Last reply
    0
    • D Dhruvil

      Hi all, Very much confuse with this. I have a datagrid, and i am able to pass the value to javascript function through "onclick" event as below: e.item.attributes.add("onclick","javascript:myfunction('"+value1+"');"); but, when i am trying to pass the value of the first row on datagrid through "onload" event as below: dg.Items[0].Attributes.Add("onload","javascript:myfunction('"+value1+"');"); it's not passing the value. I have to use onload event, so i can display default value th' javascript function. Any help will be appreciated. Thanks, NIKI

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Make sure that you run this code after the datasource is bound to the grid control. Also, you can keep using the ItemDataBound event handler, but you can detect the first row so that you only run your code with this row.

      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