<asp:GridView ID="GridView1" runat="server" align="center" AllowPaging="True" DataKeyNames="ProjectCode" AutoGenerateColumns="False" class="tabulardata" DataSourceID="SqlDataSource1" HorizontalAlign="Center" Width="100%"> <columns> <asp:TemplateField HeaderText="Sl.No" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="2%"> <itemtemplate> <asp:Label ID="Sno" runat="server"> </itemtemplate> <itemstyle horizontalalign="Center" /> <asp:BoundField HeaderText="Project Code" Visible="true" DataField="ProjectCode" ItemStyle-HorizontalAlign="center" SortExpression="ProjectCode"> <asp:BoundField HeaderText="AsstProjLead" DataField="AsstProjLead" ItemStyle-HorizontalAlign="center" ReadOnly="true" SortExpression="AsstProjLead"> </columns> <alternatingrowstyle backcolor="#FFF5F5" /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ConnectionStrings:MPP%>" SelectCommand="Select ProjectCode,emp_name+' '+ emp_initial+' - '+emp_number as AsstProjLead from csAsstProjLeads A inner join idpeapp.dbo.view_employee V on V.emp_number=A.AsstProjLead and A.Projectcode=@ProjectCode"> <SelectParameters> <asp:Parameter Name="ProjectCode" Type="String"/> </SelectParameters>
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound Dim sno As New Label Dim SrNo As Integer If e.Row.RowType = DataControlRowType.DataRow Then SrNo = (GridView1.PageIndex + 1) * 10 - 9 sno = e.Row.FindControl("Sno") sno.Text = e.Row.RowIndex + SrNo sno.DataBind() End If If e.Row.RowType = DataControlRowType.DataRow Then DataBinder.Eval(e.Row.DataItem, "ProjectNoID") End If End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)