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. javascripting to datagrid

javascripting to datagrid

Scheduled Pinned Locked Moved ASP.NET
javascriptquestion
3 Posts 3 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.
  • I Offline
    I Offline
    iamdking
    wrote on last edited by
    #1

    hello friends, I am using datagrid to list my items. I am using sqldatasource for this. but while deleting record, i want to add confirmation javascript before delete? Is it possible on datagrid?

    Amit

    E T 2 Replies Last reply
    0
    • I iamdking

      hello friends, I am using datagrid to list my items. I am using sqldatasource for this. but while deleting record, i want to add confirmation javascript before delete? Is it possible on datagrid?

      Amit

      E Offline
      E Offline
      eyeseetee
      wrote on last edited by
      #2

      Its not that easy to add in javascript to a c# script which is going to run at the server, I would try and create something through asp.net which would perform a similar task

      We are not a Code Charity

      1 Reply Last reply
      0
      • I iamdking

        hello friends, I am using datagrid to list my items. I am using sqldatasource for this. but while deleting record, i want to add confirmation javascript before delete? Is it possible on datagrid?

        Amit

        T Offline
        T Offline
        ToddHileHoffer
        wrote on last edited by
        #3

        Here is an example that should point you in the right direction. In the aspx page (datagrid property) add onItemDataBound = "itemDataBound" Codebehind should be something like this. protected void itemDataBound(object o, System.Web.UI.WebControls.DataGridItemEventArgs e) { if((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { LinkButton lb = (LinkButton)e.Item.FindControl("lLinkButton"); lb.Attributes.Add("onClick", "return confirm('Are you sure want to delete ?')"); } }

        I didn't get any requirements for the signature

        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