Tuesday, November 17, 2009

GridView !!

asp:GridView ID="GDcomp" runat="server" border="0" cellpadding="5" cellspacing="1" bgcolor="#ffffff" AutoGenerateColumns="false" AllowPaging="true" Width="100%" OnRowDataBound="GDcomp_RowDataBound" OnPageIndexChanging="GDcomp_PageIndexChanging" PageSize="10" AllowSorting="True" OnSorting="GDcomp_Sorting" ForeColor="Black">
Columns>

asp:TemplateField HeaderText="S. No.">
ItemTemplate>
<%#(GDcomp.PageIndex * 10) + Container.DisplayIndex + 1%>
/ItemTemplate>
ItemStyle BackColor="#F4F0E1" HorizontalAlign="Center" Width="6%" />
HeaderStyle BackColor="#D3CCB5" HorizontalAlign="Center" Width="6%" />
/asp:TemplateField >
asp:TemplateField HeaderText="Company Name" SortExpression="comp_name">


ItemTemplate>
a href="CompanyDetail.aspx?id=<%# DataBinder.Eval(Container, "DataItem.comp_id") %> " class="black"><%# DataBinder.Eval(Container, "DataItem.comp_name") %>
/ItemTemplate>
ItemStyle BackColor="#F4F0E1" HorizontalAlign="Center" Width="12%" />
HeaderStyle BackColor="#D3CCB5" HorizontalAlign="Center" Width="12%" />
/asp:TemplateField>



asp:BoundField DataField="comp_contact_person" HeaderText="Contact Person" SortExpression="comp_contact_person">
ItemStyle BackColor="#F4F0E1" HorizontalAlign="Center" Width="12%" />
HeaderStyle BackColor="#D3CCB5" HorizontalAlign="Center" Width="12%" />
/asp:BoundField>
asp:BoundField DataField="country_name" HeaderText="Country" SortExpression="country_name">
ItemStyle BackColor="#F4F0E1" HorizontalAlign="Center" Width="8%" />
HeaderStyle BackColor="#D3CCB5" HorizontalAlign="Center" Width="8%" />
asp:BoundField DataField="comp_state" HeaderText="State" SortExpression="comp_state">
ItemStyle BackColor="#F4F0E1" HorizontalAlign="Center" Width="10%" />
HeaderStyle BackColor="#D3CCB5" HorizontalAlign="Center" Width="10%" />
/asp:BoundField>
asp:BoundField DataField="comp_city" HeaderText="City" SortExpression="comp_city">
ItemStyle BackColor="#F4F0E1" HorizontalAlign="Center" Width="9%" />
HeaderStyle BackColor="#D3CCB5" HorizontalAlign="Center" Width="8%" />
/asp:BoundField>
asp:TemplateField HeaderText="Edit" >
itemtemplate>
a href="CompanyMaster.aspx?action=edit&ID=<%# DataBinder.Eval(Container, "DataItem.comp_id") %>" class="black">
/itemtemplate>
ItemStyle BackColor="#F4F0E1" HorizontalAlign="Center" Width="6%" />
HeaderStyle BackColor="#D3CCB5" HorizontalAlign="Center" Width="6%" />
/asp:TemplateField>
asp:BoundField DataField="comp_active" HeaderText="Status" >
ItemStyle BackColor="#F4F0E1" HorizontalAlign="Center" Width="6%" />
HeaderStyle BackColor="#D3CCB5" HorizontalAlign="Center" Width="6%" />
/asp:BoundField>
asp:TemplateField HeaderText="Delete">
itemtemplate>


/itemtemplate>
ItemStyle BackColor="#F4F0E1" HorizontalAlign="Center" Width="6%" />
HeaderStyle BackColor="#D3CCB5" HorizontalAlign="Center" Width="6%" />
/asp:TemplateField>
asp:TemplateField Visible="False" HeaderText="ad">
itemtemplate>
asp:Label ID="lblid" Text='<%#DataBinder.Eval(Container.DataItem,"comp_id")%>' runat="server">



/itemtemplate>
/asp:TemplateField>
/Columns>
PagerStyle BackColor="#BDB391" HorizontalAlign="Center" />
/asp:GridView>

No comments: