Hi @Coreysan ,
1.First check whether dts has values,
2.Are these two lines of code written in !IsPostBack?
grid1.DataSource = dts;
grid1.DataBind();
3.Is there an updatepanel in the code.
Maybe you can provide more detailed code to help you solve the problem.
Below is the demo I wrote, maybe you can refer to it:
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(@"Data Source=****");
if (!IsPostBack)
{
DataTable dts = new DataTable();
string str = "select * from data";
SqlDataAdapter adp = new SqlDataAdapter(str, conn);
adp.Fill(dts);
grid1.DataSource = dts;
grid1.DataBind();
}
}
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.