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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. problem related to gridview

problem related to gridview

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netdatabaseannouncement
4 Posts 4 Posters 5 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
    biswa47
    wrote on last edited by
    #1

    hi to all i am having some problem ..so need ur help again. there is a gridview where i am showing the employeedetails where empcode is the primary key in the a table. emp table is having empcode,name ,age,sex,. these values are getting from the frontend of the respective field. i ma able to dispaly the record in the gridview after saving it. there is an select option for each row of the gridview. my problem starts here" when i want to select any particular row of the gridview.based up on the empcode of the respective row the data shuld be dispaly in the corresponding field in the form so that i can update it. my objective is 1st i catch the empcode of the selected row and then based up on that empcode other values willbe displayed in the corresponding field of the form. i am using asp.net along with c#.net(2005) and sqlserver2005 as database.

    R U S 3 Replies Last reply
    0
    • B biswa47

      hi to all i am having some problem ..so need ur help again. there is a gridview where i am showing the employeedetails where empcode is the primary key in the a table. emp table is having empcode,name ,age,sex,. these values are getting from the frontend of the respective field. i ma able to dispaly the record in the gridview after saving it. there is an select option for each row of the gridview. my problem starts here" when i want to select any particular row of the gridview.based up on the empcode of the respective row the data shuld be dispaly in the corresponding field in the form so that i can update it. my objective is 1st i catch the empcode of the selected row and then based up on that empcode other values willbe displayed in the corresponding field of the form. i am using asp.net along with c#.net(2005) and sqlserver2005 as database.

      R Offline
      R Offline
      Rocky
      wrote on last edited by
      #2

      http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.onrowupdating.aspx[^] http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewupdateeventargs.aspx[^] there are oldValues and newValues for the row that is being updated. I think u can work it out for urself now Hope it helps

      Rocky Success is a ladder which you can't climb with your hands in your pockets.

      1 Reply Last reply
      0
      • B biswa47

        hi to all i am having some problem ..so need ur help again. there is a gridview where i am showing the employeedetails where empcode is the primary key in the a table. emp table is having empcode,name ,age,sex,. these values are getting from the frontend of the respective field. i ma able to dispaly the record in the gridview after saving it. there is an select option for each row of the gridview. my problem starts here" when i want to select any particular row of the gridview.based up on the empcode of the respective row the data shuld be dispaly in the corresponding field in the form so that i can update it. my objective is 1st i catch the empcode of the selected row and then based up on that empcode other values willbe displayed in the corresponding field of the form. i am using asp.net along with c#.net(2005) and sqlserver2005 as database.

        U Offline
        U Offline
        Usharva
        wrote on last edited by
        #3

        Hi! I guess you are using BoundFiled. when you want to update some data in gridview you have to use TemplateFiled. in TemplateField you will have ItemTemplate, EditItemTemplate and FooterTemplate. As per your requirement you need to use ItemTemplate and EditItemTemplate. ItemTemplate acts just like BoundField. EditItemTemplate allows to Update the Data. I hope this will work fine

        1 Reply Last reply
        0
        • B biswa47

          hi to all i am having some problem ..so need ur help again. there is a gridview where i am showing the employeedetails where empcode is the primary key in the a table. emp table is having empcode,name ,age,sex,. these values are getting from the frontend of the respective field. i ma able to dispaly the record in the gridview after saving it. there is an select option for each row of the gridview. my problem starts here" when i want to select any particular row of the gridview.based up on the empcode of the respective row the data shuld be dispaly in the corresponding field in the form so that i can update it. my objective is 1st i catch the empcode of the selected row and then based up on that empcode other values willbe displayed in the corresponding field of the form. i am using asp.net along with c#.net(2005) and sqlserver2005 as database.

          S Offline
          S Offline
          Sun Rays
          wrote on last edited by
          #4

          Hi, First of all you have to add Datakey names in dataGrid property. Write your empCode (i.e. Table Column Name of Employeecode) and now in Datagrid selectedindexChanges Event get that datakey value (i.e. empcode). And according to that fetch all data from database. In Event you can get datakey value like this. MyGridView.DataKeys[e.NewSelectedIndex].Value.ToString(); Now you have EmpCode so go ahead..

          Thanks, Sun Rays To get something you must have to try once. My Articles

          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