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. displaying data in a textbox by clicking a row in datagrid

displaying data in a textbox by clicking a row in datagrid

Scheduled Pinned Locked Moved ASP.NET
databasesql-serversysadminhelptutorial
3 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.
  • P Offline
    P Offline
    pranavcool
    wrote on last edited by
    #1

    I have one query related to datagrid. I have four textboxes for example textbox1,textbox2,textbox3,textbox4. And a datagrid control displaying data from sql server 2000.It has four colums say column1,column2,column3,column4. Now i want that when user click any row in that datagrid all the data of that particular row (say column1,column2,column3,column4) from a datagrid should appear in textbox1,textbox2,textbox3,textbox4. Can any one can help me.I required to do this thing in my project.If possible can any one explain this wit any example.Or please give any link on the internet explaining this thing. regards, pranav

    Pranav Dave

    N 2 Replies Last reply
    0
    • P pranavcool

      I have one query related to datagrid. I have four textboxes for example textbox1,textbox2,textbox3,textbox4. And a datagrid control displaying data from sql server 2000.It has four colums say column1,column2,column3,column4. Now i want that when user click any row in that datagrid all the data of that particular row (say column1,column2,column3,column4) from a datagrid should appear in textbox1,textbox2,textbox3,textbox4. Can any one can help me.I required to do this thing in my project.If possible can any one explain this wit any example.Or please give any link on the internet explaining this thing. regards, pranav

      Pranav Dave

      N Offline
      N Offline
      Nizha J
      wrote on last edited by
      #2

      datagrid has a property called columns.. in that choose button column and choose edit,update and camcel... then go to the codebehind window and selet datagrid name in class name combo box and edit command in method name combo box.. then write this.. Private Sub dg_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dg.EditCommand dg.EditItemIndex = e.Item.ItemIndex Dim ds As DataSet = getdata() bindgrid(ds) End Sub Public Function getdata() As DataSet Try con.Open() ada = New OleDbDataAdapter("select * from topic", con) ada.Fill(ds1) Return ds1 Catch ex As Exception Response.Write(ex.Message) Finally con.Close() End Try End Function Public Function bindgrid(ByVal ds As DataSet) dg.DataSource = ds dg.DataBind() End Function this will automatically replace a texbox with the respective values

      Nizha

      1 Reply Last reply
      0
      • P pranavcool

        I have one query related to datagrid. I have four textboxes for example textbox1,textbox2,textbox3,textbox4. And a datagrid control displaying data from sql server 2000.It has four colums say column1,column2,column3,column4. Now i want that when user click any row in that datagrid all the data of that particular row (say column1,column2,column3,column4) from a datagrid should appear in textbox1,textbox2,textbox3,textbox4. Can any one can help me.I required to do this thing in my project.If possible can any one explain this wit any example.Or please give any link on the internet explaining this thing. regards, pranav

        Pranav Dave

        N Offline
        N Offline
        Nizha J
        wrote on last edited by
        #3

        similarly you have to write statements for update and cancel.. if you have any problem.. ask..

        Nizha

        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