Link to home
Start Free TrialLog in
Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on

gridview not populating... asp.net c#

I have checked and made sure the table has data in it.

Question: Why the following code is not population the gridview?
public partial class Default3 : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ROD_July18ConnectionString"].ToString());
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            LoadData();
        }
    }
    private void LoadData()
    {
        var da = new SqlDataAdapter("SELECT * FROM t08MedCenter", con);
        var ds = new DataSet();
        da.Fill(ds);
        grdHighLight.DataBind();
    }
}
----------------------------
   <form id="form1" runat="server">
    <div>
    <asp:GridView runat="server" ID="grdHighLight" >
            
    </asp:GridView>
    </div>
    </form>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike Eghtebas

ASKER

Thank you very much.

Mike
Hi Fernando,

I wonder if you have a moment to take a look at:

https://www.experts-exchange.com/questions/28504938/asp-net-html5-validation-question.html

In this question I have problem validating for html5. <asp:gridview... > generates its own inline css attributes and html5 doesn't like it.

FYI, I have used gridview from the toolbar; perhaps I need not to use gridview from the tollbar. Instead, I may have to populate this gridview from codebehinde to have a better control on its styling.

Thanks,

Mike
I have looked at the other question but not being an web developer I would not be of any help, sorry.
Thank you for the response.

Mike
Not a problem Mike, glad I was able to help.