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. get primary key value [modified]

get primary key value [modified]

Scheduled Pinned Locked Moved ASP.NET
databasehelp
4 Posts 4 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.
  • V Offline
    V Offline
    vikas shukla
    wrote on last edited by
    #1

    hi sir please help me i want the primary key column value on gridview_rowcommand() please send me code if possible thanx hi sir i am using following code: Lock protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if ((e.CommandName).ToString() == "lock_user") { int index = Convert.ToInt32(e.CommandArgument); string userid = GridView1.Rows[index].FindControl("UserIdName").ToString(); WebMsgBox.Show(userid); } } but it gives blank messagebox and i want that userid.

    modified on Friday, July 10, 2009 6:35 AM

    P M H 3 Replies Last reply
    0
    • V vikas shukla

      hi sir please help me i want the primary key column value on gridview_rowcommand() please send me code if possible thanx hi sir i am using following code: Lock protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if ((e.CommandName).ToString() == "lock_user") { int index = Convert.ToInt32(e.CommandArgument); string userid = GridView1.Rows[index].FindControl("UserIdName").ToString(); WebMsgBox.Show(userid); } } but it gives blank messagebox and i want that userid.

      modified on Friday, July 10, 2009 6:35 AM

      P Offline
      P Offline
      padmanabhan N
      wrote on last edited by
      #2

      refer : GridView all in one[^]

      Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

      1 Reply Last reply
      0
      • V vikas shukla

        hi sir please help me i want the primary key column value on gridview_rowcommand() please send me code if possible thanx hi sir i am using following code: Lock protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if ((e.CommandName).ToString() == "lock_user") { int index = Convert.ToInt32(e.CommandArgument); string userid = GridView1.Rows[index].FindControl("UserIdName").ToString(); WebMsgBox.Show(userid); } } but it gives blank messagebox and i want that userid.

        modified on Friday, July 10, 2009 6:35 AM

        M Offline
        M Offline
        Manas Bhardwaj
        wrote on last edited by
        #3

        vikas shukla wrote:

        please send me code if possible

        What have you tried so far? A simple Google search would have gave you a nice idea.

        void mygridview_RowCommand(Object sender, GridViewCommandEventArgs e)
        {
        int index = Convert.ToInt32(e.CommandArgument);

        GridViewRow row = ContactsGridView.Rows\[index\];
        
        //use the index of the column to retrieve the value	
        //for eg 
        //string thirdcolumn = row.Cells\[2\].Text;
        //...do whatever
        

        }

        Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        1 Reply Last reply
        0
        • V vikas shukla

          hi sir please help me i want the primary key column value on gridview_rowcommand() please send me code if possible thanx hi sir i am using following code: Lock protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if ((e.CommandName).ToString() == "lock_user") { int index = Convert.ToInt32(e.CommandArgument); string userid = GridView1.Rows[index].FindControl("UserIdName").ToString(); WebMsgBox.Show(userid); } } but it gives blank messagebox and i want that userid.

          modified on Friday, July 10, 2009 6:35 AM

          H Offline
          H Offline
          himanshu2561
          wrote on last edited by
          #4

          asp:TemplateField                                                 <ItemTemplate>                                                       <asp:Button runat="server" CommandName="BtnUpdate" CommandArgument='<% Eval("PrimaryKeyField") %>' />                                                 </ItemTemplate>                                              </asp:TemplateField>

          himanshu

          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