Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
6
Reply
display gridview on button click
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
scropio gurl
8y
463
1
Reply
First i try to displaly gridview on pageload so girdveiw succesffully displayed now i try to display when click on button i try below code but grid not visible
Code
DataTable dt =
new
DataTable();
public
DataTable info(string id)
try
{
Entities2 wr =
new
Entities2();
List<spv_Result> sv = wr.spvec(id).ToList();
dt.Columns.Add(
"RowNumber"
, typeof(
int
));
foreach (var c in sv)
{
dt.Rows.Add(c.RowNumber);
}
return
dt;
}
catch
(Exception ex)
{
throw
new
Exception();
}
}
protected
void
Button1_Click(object sender, EventArgs e)
{
info(id);
GridView1.DataSource = dt;
GridView1.DataBind();
}
there is data in dt but gridview not display
<
asp:GridView
ID
=
"GridView1"
runat
=
"server"
class
=
"display nowrap"
Width
=
"100%"
CellPadding
=
"0"
Font-Names
=
"Verdana"
BackColor
=
"White"
BorderColor
=
"#CCCCCC"
BorderStyle
=
"None"
BorderWidth
=
"1px"
Font-Size
=
"9pt"
>
<
FooterStyle
BackColor
=
"White"
ForeColor
=
"#000066"
/>
<
HeaderStyle
BackColor
=
"#006699"
Font-Bold
=
"True"
ForeColor
=
"White"
/>
<
PagerStyle
BackColor
=
"White"
ForeColor
=
"#000066"
Horizontal
/>
<
RowStyle
ForeColor
=
"#000066"
/>
<
SelectedRowStyle
BackColor
=
"#669999"
Font-Bold
=
"True"
ForeColor
=
"White"
/>
<
SortedAscendingCellStyle
BackColor
=
"#F1F1F1"
/>
<
SortedAscendingHeaderStyle
BackColor
=
"#007DBB"
/>
<
SortedDescendingCellStyle
BackColor
=
"#CAC9C9"
/>
<
SortedDescendingHeaderStyle
BackColor
=
"#00547E"
/>
any solution?
Post
Reset
Cancel
Answers (
6
)
Next Recommended Forum
How to convert html to pdf
How to convert html to pdf