TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Deekshaa Singh Chauhan
NA
178
32.7k
why gridview is not visible when we run
May 27 2018 5:41 AM
I'm adding a GridView & then showing data in it from a SQL Server database. The problem is that the GridView is not displaying in the browser with or without data.
<asp:GridView ID=
"grdLocation"
runat=
"server"
AutoGenerateColumns=
"False"
onrowdatabound=
"grdLocation_RowDataBound"
onrowdeleted=
"grdLocation_RowDeleted"
Width=
"100%"
CssClass=
"grid-view"
EnableModelValidation=
"True"
ViewStateMode=
"Enabled"
>
<Columns>
<asp:TemplateField HeaderText=
"Location Name"
>
<ItemTemplate>
<asp:Label ID=
"lblShowLocationName"
runat=
"server"
Text=
'<%# Eval("Name") %>'
></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID=
"txtEditLocationName"
runat=
"server"
Text=
'<%# Eval("Name") %>'
></asp:TextBox>
<asp:RequiredFieldValidator ID=
"rfvLocationName"
runat=
"server"
ControlToValidate=
"txtEditLocationName"
SetFocusOnError=
"true"
ErrorMessage=
"*"
ValidationGroup=
"LocationUpdate"
></asp:RequiredFieldValidator>
<%--<asp:RegularExpressionValidator ID=
"rexvLocationNameEdit"
runat=
"server"
ControlToValidate=
"txtEditLocationName"
SetFocusOnError=
"true"
ValidationGroup=
"Location"
ValidationExpression=
"^[a-zA-Z ]*$"
ErrorMessage=
"Only Alphabets Allowed"
Display=
"Dynamic"
></asp:RegularExpressionValidator>--%>
</EditItemTemplate>
<HeaderStyle HorizontalAlign=
"Left"
VerticalAlign=
"Middle"
/>
<ItemStyle HorizontalAlign=
"Left"
VerticalAlign=
"Middle"
/>
</asp:TemplateField>
<asp:TemplateField HeaderText=
"Location Code"
>
<ItemTemplate>
<asp:Label ID=
"lblShowLocationCode"
runat=
"server"
Text=
'<%# Eval("Code") %>'
></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID=
"txtEditLocationCode"
runat=
"server"
Text=
'<%# Eval("Code") %>'
></asp:TextBox>
</EditItemTemplate>
<ItemStyle HorizontalAlign=
"Left"
VerticalAlign=
"Middle"
/>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID=
"imgBtnshow"
runat=
"server"
ToolTip=
"View"
CommandArgument=
'<%# Eval("LocationId") %>'
ImageUrl=
"~/Images/file_edit.png"
onclick=
"imgBtnshow_Click"
/>
</ItemTemplate>
<EditItemTemplate>
<asp:ImageButton ID=
"imgBtnEdit"
runat=
"server"
CommandArgument=
'<%# Eval("LocationId") %>'
ImageUrl=
"~/Images/buttonsave.png"
OnClick=
"imgBtnEdit_Click"
ValidationGroup=
"LocationUpdate"
ToolTip=
"Update"
/>
<asp:ImageButton ID=
"imgBtnCancel"
runat=
"server"
ToolTip=
"Cancel"
ImageUrl=
"~/Images/1350368827_save_delete.png"
onclick=
"imgBtnCancel_Click"
/>
</EditItemTemplate>
<ItemStyle Width=
"50px"
/>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID=
"imgBtnDelete"
runat=
"server"
CommandArgument=
'<%# Eval("LocationId") %>'
ImageUrl=
"~/Images/delete-256.png"
OnClick=
"imgBtnDelete_Click"
OnClientClick=
"Confirm()"
ToolTip=
"Delete"
/>
</ItemTemplate>
<ItemStyle Width=
"50px"
/>
</asp:TemplateField>
</Columns>
</asp:GridView>
Reply
Answers (
3
)
Authentification webapi ASP.NET MVC
Write way of ASP.NET MVC project development