Dear All,

Hope all is doing well, I am developing a portal in ASP.NET 2.0, I am developing a page where I will have multiple search option for to display selected field in gridview.

I have setup a dropdown list which is connected with gridview and showing the customized result after selection of item from dropdown list.

Further i have added a column which having "detail" button in front of each record in gridview, now i want to configure this button with detailview, I want when I click on detail button the complete result comes of that record into the detailview.

I am using MsAccess database with vb and i am configuring vb in separate code file.

I would be grateful if any one can help me in development of this website.

Thanking you in advance.

Regards,

Firstly set DataKeyNames property of the gridview to the primary key field of your table.

now in the selectedindexchange event handler of gridview retrieve the newitemindex attribute of eventargument. using this index populate the detailsview in this event handler.

Please check the code below for your reference.

Protected Sub ddl_order_search_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl_order_search.Click

      
        Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\dbase\db1.mdb")
        Dim da As New OleDbDataAdapter("select refid, fullname, email, papertype, titlepaper, orderdeadline, amountpay, orderdatetime, orderstatus from OrderRecord where orderstatus ='" & Me.ddl_orders.SelectedItem.Text & "'", cn)

        Dim dt As New Data.DataTable
        da.Fill(dt)
        da.Dispose()
        cn.Dispose()
        
        Me.gv_order_status.DataSource = dt
        Me.gv_order_status.DataBind()

    End Sub

______________________________

Please check the gridview style and details in below code:

<asp:GridView ID="gv_order_status" runat="server"
    AutoGenerateColumns = "False"
    AllowPaging  = "True"
    AllowSorting = "True"
    CellPadding  = "4"
    ForeColor    = "#333333"
    GridLines="None" Font-Names="Arial" Font-Size="Smaller">
      <Columns>
        <asp:BoundField    HeaderText="Ref ID"         DataField="refid" />
        <asp:BoundField    HeaderText="Name"           DataField="fullname" />
        <asp:BoundField    HeaderText="Email ID"       DataField="email" />
        <asp:BoundField    HeaderText="Paper Type"     DataField="papertype" />
        <asp:BoundField    HeaderText="Title Paper"    DataField="titlepaper" />
        <asp:BoundField    HeaderText="Deadline"       DataField="orderdeadline" />
        <asp:BoundField    HeaderText="Order Value"    DataField="amountpay" />
        <asp:BoundField    HeaderText="Order Date"     DataField="OrderDeadline" />
        <asp:BoundField    HeaderText="Delivery Date"  DataField="orderdatetime" />
        <asp:BoundField    HeaderText="Order Status"   DataField="orderstatus" />
          <asp:ButtonField ButtonType="Button" CommandName="detailview" Text="Detail" />
        
        
      </Columns>
      <HeaderStyle         BackColor="#333399" ForeColor="White" Font-Bold="True" />
      <RowStyle            BackColor="#CCCCCC" />
      <AlternatingRowStyle BackColor="White" />
      <PagerStyle          BackColor="#333399" ForeColor="White" HorizontalAlign="Center" />
  </asp:GridView>

Now i want to use the gridview button which is displayed in front of each record, i want to click and get the complete details of that record into the detailview.

Thanking you.

fahheem,

Wrap up source code with bb code tags. Click on hyperlinks at post #3.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.