Need help to configure MS Access Database with gridview and detail view option

Last post 07-05-2009 6:25 PM by ffaheem. 2 replies.

Sort Posts:

  • Need help to configure MS Access Database with gridview and detail view option

    07-04-2009, 7:33 PM
    • Member
      point Member
    • ffaheem
    • Member since 11-13-2008, 2:41 PM
    • Posts 3

    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,

    SEO Consultant
  • Re: Need help to configure MS Access Database with gridview and detail view option

    07-05-2009, 7:30 AM
    • Star
      9,214 point Star
    • hans_v
    • Member since 01-29-2007, 9:03 PM
    • Posts 1,594

     That's not so difficult. Make sure you've set the DataKeyNames property of the Gridview to the Primary Key field(s) of the dataset of the gridview. Then set CommandName Property of the button in the GridView Rows to "Select"

    And then you can set the SelectParameter of the DetailsView DataSource to:

    <asp:ControlParameter ControlID="GridView1" PropertyName="SelectedValue" Name="PrimaryKeyField" />

  • Re: Need help to configure MS Access Database with gridview and detail view option

    07-05-2009, 6:25 PM
    • Member
      point Member
    • ffaheem
    • Member since 11-13-2008, 2:41 PM
    • Posts 3

    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.



    SEO Consultant
Page 1 of 1 (3 items)