1. Define Your GridView as
<asp:Panel ID="Panel1" runat="server" Height="200px" Width="200px" ScrollBars="Vertical">
<asp:GridView ID="GridView1" runat="server" RowStyle-VerticalAlign="Bottom" OnRowDataBound="GridView1_RowDataBound">
<HeaderStyle CssClass="header" Height="20px" />
</asp:GridView>
</asp:Panel>
2. Create a style as
<style type="text/css">
.header
{
font-weight:bold;
position:absolute;
background-color:White;
}
</style>
3. Add Following code at RowDataBound Event of GridView
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
e.Row.Style.Add("height", "40px")
End If
End If
End Sub
-------------------------------------------------------------------------------------------------------
Alternativelyyou can simply do this tooo
<asp:Panel ID="Panel1" runat="server" BorderStyle="Ridge" BorderWidth="2" ScrollBars="Vertical" Width="850" Height="520px" horizontalAlign="NotSet" >
<asp:GridView ID="GridView1" runat="server" >
</asp:GridView>
</asp:Panel>
Asking questions are really good thing if you are not understanding anything totally, however
ReplyDeletethis paragraph offers pleasant understanding even.
Nice Blog.
ReplyDeleteRead the blog in details with all the points that are mentioned and I believe that this is the best article I've gone through. Everyone should check this blog as a tutorial.
Thanks for sharing such a great blog.
Asp Dot Net Core