Click here to Skip to main content
15,921,694 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to show line below every row of grid. but it doesn't appear i used css class="table" and put grid inside table with proper tr and td. what to do so that every row separated by line.

What I have tried:

<asp:GridView runat="server" ID="Gridstoremanager" AutoGenerateColumns="false" GridLines="None" AllowPaging="true" OnPageIndexChanging="Gridstoremanager_PageIndexChanging" PageSize="10" CssClass="table" Width="100%" EmptyDataText="Store Manager Not Found!!!" OnRowDataBound="Gridstore_RowDataBound">
<columns> <asp:TemplateField HeaderText="Sr. No.">
<itemtemplate>
<%#Container.DataItemIndex+1 %>


<asp:BoundField DataField="Name" HeaderText="Manager Name" />
<asp:BoundField DataField="EmailId" HeaderText="EmailId" />
<asp:BoundField DataField="StoreName" HeaderText="Store Name" />
<asp:BoundField DataField="MobileNo" HeaderText="Mobile No." />
<asp:BoundField DataField="EmpStatus" HeaderText="Status" />
<asp:TemplateField ItemStyle-HorizontalAlign="Right" HeaderText="View">
<itemtemplate>
<asp:ImageButton ID="ImageBtnEdit" ImageUrl="~/Icons/btn-edit.png" CommandArgument='<%#Eval("EmpId") %>' runat="server" ToolTip="Click here to Edit Manager" OnClick="ImageBtnEdit_Click" />
<asp:ImageButton ID="Imagebtnact" CommandArgument='<%#Eval("EmpId")%>' runat="server" OnClick="Imagebtnact_Click" />
<asp:ImageButton ID="ImageBtndel" ImageUrl="~/Icons/delete-icon.png" ToolTip="Click here to Delete Manager" CommandArgument='<%#Eval("EmpId") %>' runat="server" OnClientClick="return fnConfirm();" OnClick="ImageBtndel_Click" />


<pagerstyle cssclass="pagination-ys">

Posted
Updated 26-Apr-16 0:23am

1 solution

change the GridLines[^] Property to Horizontal or Both

HTML
GridLines="Horizontal"



<asp:gridview runat="server" id="Gridstoremanager" autogeneratecolumns="false" GridLines="None" AllowPaging="true" OnPageIndexChanging="Gridstoremanager_PageIndexChanging" PageSize="10" CssClass="table" Width="100%" EmptyDataText="Store Manager Not Found!!!" OnRowDataBound="Gridstore_RowDataBound">


Create Row Created Event for the gridview and update it as

C#
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
       {
           if (e.Row.RowType == DataControlRowType.DataRow)
           {
               for (int i = 0; i < e.Row.Cells.Count; i++)
               {
                   e.Row.Cells[i].Style.Add("border-bottom", "3px solid red");
               }

           }
       }
 
Share this answer
 
v3
Comments
Member 12423456 26-Apr-16 6:42am    
sorry but u interpret me wrong i want line below the every row of grid not the border of grid. please tell me solution in that way. i apply changes told by u but it cause effect which i don't want.
Karthik_Mahalingam 26-Apr-16 6:47am    
have you changed the property to GridLines="Horizontal" ?
Member 12423456 26-Apr-16 7:24am    
yes i have changed but it cause other effect which i don't want. i need horizontal line after every line or record of grid... i think i didn't make you clear what i want. Am i? The code which i have send to above,i have done same code in another page it shows me proper grid with horizontal line after every row.
Karthik_Mahalingam 26-Apr-16 7:37am    
check my updated solution.
Member 12423456 26-Apr-16 7:51am    
can i send u my both the ASPX pages so u can understand more clearly what i want to say.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900