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. help is needed in displaying different contents inside formview on linkbutton click

help is needed in displaying different contents inside formview on linkbutton click

Scheduled Pinned Locked Moved ASP.NET
helpdatabasedesignsysadmintutorial
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.
  • R Offline
    R Offline
    Rameez Raja
    wrote on last edited by
    #1

    Hi all, iam not able to figure out what i have to do for displaying related record details inside formveiew on linkbutton click . i have added seperate linkbutton for each reservation and wants to display record details inside formview but problem is that only single record is displaying on all linkbutton clck i have seven records in table . here is my code

    sqlcmd.CommandText = "Select Reserve_ID from Reservedvehicle"
    sqlcmd.Connection = sqlconn
    Dim sqlrdr As SqlDataReader = sqlcmd.ExecuteReader
    While sqlrdr.Read()
    Dim tblcell As TableCell = New TableCell()
    Dim tblrow As TableRow = New TableRow()
    Dim lnk As New LinkButton
    lnk.Text = "click here for details "
    lnk.CommandArgument = (sqlrdr("Reserve_ID"))
    'add Click functionaliuty
    AddHandler lnk.Command, AddressOf OnClickLink
    tblcell.Controls.Add(lnk)
    tblrow.Cells.Add(tblcell)
    Table1.Rows.Add(tblrow)
    End While
    sqlrdr.Close()

    Here is event handler :

    Protected Sub OnClickLink(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
    Dim lnkbutton As linkbutton = sender
    Dim param As String = e.CommandArgument
    FormView1.Visible = True
    Dim myConnection As New SqlConnection("Server=localhost;Database=Reservation;uid=sa;pwd=server")
    Dim ad As New SqlDataAdapter("SELECT * FROM reservedvehicle ", myConnection)
    Dim ds As New DataSet()
    ad.Fill(ds)
    FormView1.DataSource = ds
    FormView1.DataBind()
    End Sub

    can any body guide me what i have to do to reslove this issue . Best Regards Rameez

    G B S 3 Replies Last reply
    0
    • R Rameez Raja

      Hi all, iam not able to figure out what i have to do for displaying related record details inside formveiew on linkbutton click . i have added seperate linkbutton for each reservation and wants to display record details inside formview but problem is that only single record is displaying on all linkbutton clck i have seven records in table . here is my code

      sqlcmd.CommandText = "Select Reserve_ID from Reservedvehicle"
      sqlcmd.Connection = sqlconn
      Dim sqlrdr As SqlDataReader = sqlcmd.ExecuteReader
      While sqlrdr.Read()
      Dim tblcell As TableCell = New TableCell()
      Dim tblrow As TableRow = New TableRow()
      Dim lnk As New LinkButton
      lnk.Text = "click here for details "
      lnk.CommandArgument = (sqlrdr("Reserve_ID"))
      'add Click functionaliuty
      AddHandler lnk.Command, AddressOf OnClickLink
      tblcell.Controls.Add(lnk)
      tblrow.Cells.Add(tblcell)
      Table1.Rows.Add(tblrow)
      End While
      sqlrdr.Close()

      Here is event handler :

      Protected Sub OnClickLink(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
      Dim lnkbutton As linkbutton = sender
      Dim param As String = e.CommandArgument
      FormView1.Visible = True
      Dim myConnection As New SqlConnection("Server=localhost;Database=Reservation;uid=sa;pwd=server")
      Dim ad As New SqlDataAdapter("SELECT * FROM reservedvehicle ", myConnection)
      Dim ds As New DataSet()
      ad.Fill(ds)
      FormView1.DataSource = ds
      FormView1.DataBind()
      End Sub

      can any body guide me what i have to do to reslove this issue . Best Regards Rameez

      G Offline
      G Offline
      Gamzun
      wrote on last edited by
      #2

      DetailView/FormView are designed to show single record at a time. User GridView instead.

      1 Reply Last reply
      0
      • R Rameez Raja

        Hi all, iam not able to figure out what i have to do for displaying related record details inside formveiew on linkbutton click . i have added seperate linkbutton for each reservation and wants to display record details inside formview but problem is that only single record is displaying on all linkbutton clck i have seven records in table . here is my code

        sqlcmd.CommandText = "Select Reserve_ID from Reservedvehicle"
        sqlcmd.Connection = sqlconn
        Dim sqlrdr As SqlDataReader = sqlcmd.ExecuteReader
        While sqlrdr.Read()
        Dim tblcell As TableCell = New TableCell()
        Dim tblrow As TableRow = New TableRow()
        Dim lnk As New LinkButton
        lnk.Text = "click here for details "
        lnk.CommandArgument = (sqlrdr("Reserve_ID"))
        'add Click functionaliuty
        AddHandler lnk.Command, AddressOf OnClickLink
        tblcell.Controls.Add(lnk)
        tblrow.Cells.Add(tblcell)
        Table1.Rows.Add(tblrow)
        End While
        sqlrdr.Close()

        Here is event handler :

        Protected Sub OnClickLink(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
        Dim lnkbutton As linkbutton = sender
        Dim param As String = e.CommandArgument
        FormView1.Visible = True
        Dim myConnection As New SqlConnection("Server=localhost;Database=Reservation;uid=sa;pwd=server")
        Dim ad As New SqlDataAdapter("SELECT * FROM reservedvehicle ", myConnection)
        Dim ds As New DataSet()
        ad.Fill(ds)
        FormView1.DataSource = ds
        FormView1.DataBind()
        End Sub

        can any body guide me what i have to do to reslove this issue . Best Regards Rameez

        B Offline
        B Offline
        Blumen
        wrote on last edited by
        #3

        Though DetailsView/FormView displays one record at a time, you may enable paging for these controls.. Thus user can navigate and view all the records, but one at a time.

        1 Reply Last reply
        0
        • R Rameez Raja

          Hi all, iam not able to figure out what i have to do for displaying related record details inside formveiew on linkbutton click . i have added seperate linkbutton for each reservation and wants to display record details inside formview but problem is that only single record is displaying on all linkbutton clck i have seven records in table . here is my code

          sqlcmd.CommandText = "Select Reserve_ID from Reservedvehicle"
          sqlcmd.Connection = sqlconn
          Dim sqlrdr As SqlDataReader = sqlcmd.ExecuteReader
          While sqlrdr.Read()
          Dim tblcell As TableCell = New TableCell()
          Dim tblrow As TableRow = New TableRow()
          Dim lnk As New LinkButton
          lnk.Text = "click here for details "
          lnk.CommandArgument = (sqlrdr("Reserve_ID"))
          'add Click functionaliuty
          AddHandler lnk.Command, AddressOf OnClickLink
          tblcell.Controls.Add(lnk)
          tblrow.Cells.Add(tblcell)
          Table1.Rows.Add(tblrow)
          End While
          sqlrdr.Close()

          Here is event handler :

          Protected Sub OnClickLink(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
          Dim lnkbutton As linkbutton = sender
          Dim param As String = e.CommandArgument
          FormView1.Visible = True
          Dim myConnection As New SqlConnection("Server=localhost;Database=Reservation;uid=sa;pwd=server")
          Dim ad As New SqlDataAdapter("SELECT * FROM reservedvehicle ", myConnection)
          Dim ds As New DataSet()
          ad.Fill(ds)
          FormView1.DataSource = ds
          FormView1.DataBind()
          End Sub

          can any body guide me what i have to do to reslove this issue . Best Regards Rameez

          S Offline
          S Offline
          SunithaNallana
          wrote on last edited by
          #4

          Hi, U hv properly coded but while retrieving data from Db to binding Formview u r not sending the Command Argument(Reserve_id) to Db.If u send that u can retrieve particular record based on reserve_id

          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