Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8533905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:04:21+00:00 2026-06-11T10:04:21+00:00

I have my GridView populating like so: <asp:Panel ID=pnlGrid runat=server> <div class=m_container style=margin-bottom:20px;> <asp:GridView

  • 0

I have my GridView populating like so:

<asp:Panel ID="pnlGrid" runat="server">
    <div class="m_container" style="margin-bottom:20px;">
        <asp:GridView ID="grdView" runat="server" CssClass="GridViewStyle"
            AutoGenerateColumns="False" GridLines="None" Width="125%" onrowdatabound="builderGridView_RowDataBound" >
            <Columns>
                <asp:BoundField DataField="id" Visible="False" />
                <asp:BoundField HeaderText="Info" />
                <asp:TemplateField>
                  <ItemTemplate>
                    <asp:LinkButton name='<%#Eval("status") %>' CommandArgument='<%#Eval("id")%>' runat="server" Text='<%#Eval("status")%>' CommandName='<%#Eval("status")%>' ID="statusLink" />
                  </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <RowStyle CssClass="RowS" />
            <EmptyDataRowStyle CssClass="EmptyS" />
            <PagerStyle CssClass="PagerStyle" />
            <SelectedRowStyle CssClass="SelectedS" />
            <HeaderStyle CssClass="HeaderS" />
            <EditRowStyle CssClass="EditRowS" />
            <AlternatingRowStyle CssClass="AltRowS" />
        </asp:GridView>
    </div>
</asp:Panel>
</asp:Content>

And the code behind is:

Private Sub LoadData(ByRef theStatus As Integer)
    Dim objConn As MySqlConnection
    Dim objCmd As MySqlCommand

    objConn = New MySqlConnection(strConnString)
    objConn.Open()

    Dim strSQL As String
    strSQL = "SELECT * FROM theTable WHERE status=" & theStatus & " ORDER BY created_on, status DESC;"

    Dim dtReader As MySqlDataReader
    objCmd = New MySqlCommand(strSQL, objConn)
    dtReader = objCmd.ExecuteReader()

    grdView.DataSource = dtReader
    grdView.DataBind()

    dtReader.Close()
    dtReader = Nothing

    objConn.Close()
    objConn = Nothing
End Sub

Then after the above i create a LinkButton for each row like so:

Sub builderGridView_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
    If e.Row.RowType = DataControlRowType.DataRow Then
        Dim lbtn As LinkButton = DirectCast(e.Row.FindControl("statusLink"), LinkButton)

        e.Row.Cells(1).Text = "TEST!"

        If lbtn.Text = 0 Then
            Dim lb As New LinkButton()
            lb.Text = "Accept"
            lb.CommandName = lbtn.CommandName
            lb.CommandArgument = lbtn.CommandArgument
            lb.Attributes.Add("class", "nounderline")
            lb.ForeColor = System.Drawing.Color.Green
            lb.Font.Bold = True
            lb.Font.Size = 12

            lb.OnClientClick = "location.href = '/page.aspx?ID=" & pageID & "&dbid=" & lb.CommandArgument & "&ACCEPT=yes'; return false;"
            e.Row.Cells(4).Controls.Add(lb)
        End If
    End If
End Sub

How can i get values from the database (name, address, email address, etc etc) and place it within the current row its going through?

example:

(when its looping through the rows)

e.Row.Cells(1).Text = database("FName") & "<BR />" & database("LName") & "<BR />"...etc etc

Would look like this in the first row column:

Bob
Barker

How can i grab whats currently being read from the DB?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:04:22+00:00Added an answer on June 11, 2026 at 10:04 am

    builderGridView_RowDataBound event fill be handled for each row from the database.

    e.Row.DataItem will contain the item from the database

    Edit:
    Better way would be

    Using adap As New MySqlDataAdapter(objCmd)
        Dim table As New DataTable()
        adap.Fill(table)
    grdView.DataSource = table;
    grdview.DataBind();
    

    Adapter will load all records to the DataTable.

    Then your e.Row.DataItem will be of type DataRow

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a gridview table like this... <div> <asp:GridView ID=GridView1 runat=server AllowSorting=true OnSorting=TaskGridView_Sorting >
I have GridView and Button controls nested inside a Panel . <asp:Panel ID=PanelPopUp runat=server>
I have a Datagrid which looks as under <asp:GridView ID=dgTask runat=server Width=100% AutoGenerateColumns=False> <Columns>
i have gridview in my asp.net webform. i bind my database to gridview like
I have a grid view in asp.net which I am populating like this: sda1
I have a gridview I am populating it by creating a datatable filling that
I have a GridView which I am populating by calling a method to return
I have a GridView like this( main.xml ): <?xml version=1.0 encoding=utf-8?> <GridView xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/gridView1
I have the following checkboxes in my gridview: <asp:TemplateField HeaderText=Active> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, Active)%>
within an asp.net webform project I have a session variable that I am populating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.