RequiredFieldValidator is not Valid even if there is values - asp.net

I have a Page Fruit that has a UpdatePanel P1 and a ModalWIndow (outside of the updatepanel). I have a Page Apple with An UpdatePanel P2. ModalWindow on Page fruit will add Page Apple on demand.
Now, In the Apple Page
I have a GridView with EditItemTemplate and FooterItemtemplate for lets say 5 columns. Both of them have RegularExpressionValidator and RequiredFieldValidtor each separated by ValidationGroup. For EditItemTemplate everything is on point.
For FooterItemTemplate, the button won't do postback even though all the validation is met.
The footer template looks like this for the column of interest
<FooterTemplate>
<asp:TextBox ID="vendorAdd" runat="server" Width="95%"/>
<asp:RegularExpressionValidator ID="RegularExpressionValidator66" ControlToValidate="vendorAdd" ValidationGroup="AddValidation"
ValidationExpression="\w*" runat="server" ErrorMessage="Invalid VendorName" />
<asp:RequiredFieldValidator id = "RegularExpressionValidator67" ValidationGroup="AddValidation" ControlToValidate="vendorAdd"
runat="server" ErrorMessage="VendorName Required" />
</FooterTemplate>
There is no message saying this failed. I removed the all the other validation on other footer column than shown above. I added on the button to stop validation. And in Server side added this
Page.Validate("AddValidation");
var b = Page.IsValid;
var notValidValidators = Page.Validators.Cast<IValidator>().Where(v => !v.IsValid);`
Here in the debugger the notValidValidator says that RequiredFieldValidator is not Valid. I don't see why though, I have a value and there is no message on the front end.
Update Panel on Apple Page full Code is below
<asp:UpdatePanel ID="ackPanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="ackedItems" runat="server" Width="720" Visible="true" DataKeyNames="AckId" RowStyle-Height="10px"
AutoGenerateColumns="False" BorderStyle="Dotted" BorderWidth="1px" CellPadding="2"
BackColor="White" BorderColor="#CCCCCC" HorizontalAlign="Left" AllowPaging="false"
ShowFooter="true" OnRowUpdating="AckedItems_RowUpdating" OnRowDeleting="AckedItems_RowDeleting"
OnRowEditing="AckedItems_RowEditing" OnRowCommand="AckedItems_RowCommand" OnRowDataBound="AckedItems_RowDataBound">
<RowStyle ForeColor="#000066" Font-Size="8pt" />
<HeaderStyle ForeColor="#336699" Font-Size="8pt" CssClass="GridViewHeader" Height="20px" />
<AlternatingRowStyle CssClass="GridViewAltStyle" />
<Columns >
<asp:BoundField DataField="AckId" ReadOnly="true" Visible="false" />
<asp:TemplateField HeaderText="Vendor" HeaderStyle-Width="10%">
<ItemTemplate>
<asp:Label ID="vendor" runat="server" Text='<%# Bind("VendorName") %>' Width="95%"/>
</ItemTemplate>
<EditItemTemplate >
<asp:TextBox ID="vendorEdit" runat="server" Text='<%# Bind("VendorName") %>' Width="95%"/>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="vendorEdit" ValidationGroup="EditValidation"
ValidationExpression="\w*" runat="server" ErrorMessage="Invalid VendorName" />
<asp:RequiredFieldValidator id = "Ab" ValidationGroup="EditValidation" ControlToValidate="vendorEdit"
runat="server" ErrorMessage="VendorName Required" />
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="vendorAdd" runat="server" Width="95%"/>
<asp:RegularExpressionValidator ID="RegularExpressionValidator66" ControlToValidate="vendorAdd" ValidationGroup="AddValidation"
ValidationExpression="\w*" runat="server" ErrorMessage="Invalid VendorName" />
<asp:RequiredFieldValidator id = "RegularExpressionValidator67" ValidationGroup="AddValidation" ControlToValidate="vendorAdd"
runat="server" ErrorMessage="VendorName Required" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Amount" HeaderStyle-Width="10px">
<ItemTemplate>
<asp:Label ID="amount" DataFormatString = "{0:C2}" runat="server" Text='<%# Bind("Amount") %>' Width="95%" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="amountEdit" runat="server" Text='<%# Bind("Amount") %>' Width="95%"/>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" ControlToValidate="amountEdit" ValidationGroup="EditValidation"
ValidationExpression="\d*(\.\d*)?" runat="server" ErrorMessage="Invalid Amount" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" ValidationGroup="EditValidation" ControlToValidate="amountEdit"
runat="server" ErrorMessage="Amount Required" />
</EditItemTemplate>
<FooterTemplate >
<asp:TextBox ID="amountAdd" runat="server"
Width="95%" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator4" ControlToValidate="amountAdd" ValidationGroup="AddValidation"
ValidationExpression="\d*(\.\d*)?" runat="server" ErrorMessage="Invalid Amount" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Type">
<ItemTemplate>
<asp:Label ID="type" runat="server" Text='<%# Bind("Type") %>' Width="95%" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="typeEdit" runat="server" Text='<%# Bind("Type") %>' Width="95%" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator5" ControlToValidate="typeEdit" ValidationGroup="EditValidation"
ValidationExpression="\w*" runat="server" ErrorMessage="Invalid Type" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" ValidationGroup="EditValidation" ControlToValidate="typeEdit"
runat="server" ErrorMessage="Type Required" />
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="typeAdd" runat="server" Width="95%" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" ControlToValidate="typeAdd"
ValidationGroup="AddValidation" ValidationExpression="\w*" runat="server" ErrorMessage="Invalid Type" />
</FooterTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ProgNum" ReadOnly="true" HeaderText="ProgNum" ControlStyle-Width="95%" />
<asp:TemplateField HeaderText="AckDate">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#Convert.ToDateTime(Eval("AckDate")).ToString("MM/dd/yyyy") %>' Width="95%"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Notes" >
<ItemTemplate>
<asp:Label ID="notes" runat="server" Text='<%# Bind("Notes") %>' Width="95%" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="notesEdit" Text='<%# Bind("Notes") %>' runat="server" Width="95%"/>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="notesAdd" runat="server" Width="95
%" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ActivityDate">
<ItemTemplate>
<asp:Label ID="activityDate" runat="server" Text='<%#Convert.ToDateTime(Eval("activityDate")).ToString("MM/dd/yyyy") %>' Width="95%" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="activityDateEdit" Text='<%#Convert.ToDateTime(Eval("activityDate")).ToString("MM/dd/yyyy") %>' runat="server" CssClass="date" Width="95%" />
<asp:CompareValidator ID="CompareValidator1" runat="server" Type="Date" Operator="DataTypeCheck" ValidationGroup="EditValidation"
ControlToValidate="activityDateEdit" ErrorMessage="Invalid Date" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" ValidationGroup="EditValidation" ControlToValidate="activityDateEdit"
runat="server" ErrorMessage="Date Required" />
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="activityDateAdd" runat="server" CssClass="date" Width="95%"/>
<asp:CompareValidator ID="CompareValidator2" runat="server" Type="Date" Operator="DataTypeCheck" ValidationGroup="AddValidation"
ControlToValidate="activityDateAdd" ErrorMessage="Invalid Date" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="IsVoid">
<ItemTemplate>
<asp:CheckBox ID="isVoid" runat="server" Checked='<%# Eval("IsVoid") %>' Width="95%" />
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox ID="isVoidEdit" runat="server" Checked='<%# Eval("IsVoid") %>' Width="95%" />
</EditItemTemplate>
<FooterTemplate>
<asp:CheckBox ID="isVoidAdd" runat="server" Width="95%" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="VoidReason">
<ItemTemplate>
<asp:Label ID="voidReason" runat="server" Text='<%# Bind("VoidReason") %>' Width="95%" />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="voidReasonEdit" runat="server" Width="95%" />
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="voidReasonAdd" runat="server" Width="95%" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:LinkButton ID="lbEdit" runat="server" CausesValidation="false" CommandName="Edit"
Text="<img border=0 src=../Theme/Main/Images/edit.gif alt=Edit>" />
<asp:LinkButton ID="lbDelete" runat="server" CausesValidation="false" CommandName="Delete"
OnClientClick="if(!confirm('Do You Really want to Delete this Order Item?')) return false;"
Text="<img border=0 src=../Theme/Main/Images/delete.gif alt=Delete>" />
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="lbAdd" runat="server" CausesValidation="true" CommandName="Update"
ValidationGroup="EditValidation" Text="<img border=0 src=../Theme/Main/Images/check.gif alt=Update>" />
<asp:LinkButton ID="lbDelete" runat="server" CausesValidation="false" CommandName="Cancel"
Text="<img border=0 src=../Theme/Main/Images/delete.gif alt=Cancel>" />
</EditItemTemplate>
<FooterStyle HorizontalAlign="Center" VerticalAlign="Top" />
<FooterTemplate>
<asp:LinkButton ID="lbAdd" runat="server" CausesValidation="false" CommandName="Add"
ValidationGroup="AddValidation" Text="<img border=0 src=../Theme/Main/Images/check.gif alt=Add>" />
<asp:LinkButton ID="lbDelete" runat="server" CausesValidation="false" CommandName="Cancel"
Text="<img border=0 src=../Theme/Main/Images/delete.gif alt=Cancel>" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
<asp:TextBox ID="vendorEdit" runat="server" Text='<%# Bind("Vendor") %>' CssClass="InputTextBox"
Width="100px" />
</EmptyDataTemplate>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="lbEdit" EventName="Click" />
</Triggers>
</asp:UpdatePanel>

Related

How to loop through controls within a gridview and store their values in an array?

please excuse this potentially long post as I feel like most of the information I will add below is necessary. As the title states I am trying to loop through a collection of controls that are within a gridview on my page (there are 2 gridviews actually, but they are identical in behavior) and store the values of some of these controls in an array that I can use to perform other functions.
To start I have added the code for the gridview below.
<asp:Panel ID="gridPNL1" runat="server">
Repair / Labor<asp:LinkButton runat="server" ID="lbAddRepair" Text="Add New Repair / Labor" CommandName="AddLabor" OnClick="AddObject_Click" Enabled="false" style="margin-left:20px" Visible="false" />
<asp:GridView ID="GridView1" runat="server"
EmptyDataText="No Claimed Labor" AutoGenerateColumns="False"
ShowHeaderWhenEmpty="True" DataKeyNames="RecID"
ShowFooter="True" DataSourceID="SqlDataSource6" Width="95%">
<RowStyle HorizontalAlign="Center" />
<EmptyDataTemplate>
<asp:DropDownList ID="ddlRepairEquipmentNew" runat="server" DataSourceID="SqlDataSourcePartEquipment" DataValueField="RecID"
DataTextField="EquipmentPart" AppendDataBoundItems="True" AutoPostBack="True" Width="220px" Height="20px"
Style="margin-left: 70px;" > <%-- Removed the OnSelectedIndexChanged (add if needed) --%>
<asp:ListItem Value ="0">---SELECT---</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddlRepairNew" runat="server" DataSourceID="SqlDataSourceRepair" DataValueField="RecID"
DataTextField="Description" AppendDataBoundItems="True" Width="220px" Height="20px" AutoPostBack="true"
style="" OnSelectedIndexChanged="ddlRepairNew_SelectedIndexChanged"
OnDataBinding="ddlRepairNew_DataBinding">
<asp:ListItem Value="0">---SELECT---</asp:ListItem>
</asp:DropDownList>
<%-- <asp:textbox ID="txtDescOther" runat="server" Width="235px" Visible="false" />--%>
<asp:textbox runat="server" ID="txtRepairHoursNew" Width="95px" style="margin-left: 68px"/>
<%--<asp:Label runat="server" ID="lblRepairHoursAllowed"></asp:Label>--%>
<asp:HiddenField runat="server" ID="hidAllowedRepairHoursNew" />
<%-- <asp:textbox ID="txtAllowedHoursNew" runat="server" Width="90px"/>--%>
<asp:textbox ID="txtRepairCostNew" runat="server" Width="95px" ReadOnly="True"/>
<asp:textbox ID="txtLineTotalNew" runat="server" Width="95px" ReadOnly="true"/>
<asp:textbox ID="txtTaxNew" runat="server" Width="95px" text="0"/>
<asp:Button ID="InsertDetail" runat="server" CommandName="InsertDetail" Height="25px" Text="Add Detail" Width="85px" />
</EmptyDataTemplate>
<AlternatingRowStyle BackColor="#CCCCCC" />
<Columns>
<asp:CommandField ShowEditButton="True" footertext="Add -->" ShowDeleteButton="True" HeaderStyle-Width="70px"/>
<asp:BoundField DataField="RecID" HeaderText="RecID" SortExpression="RecID" ReadOnly="True" Visible="False" />
<asp:TemplateField HeaderText="Equipment / Repair / Labor Description" ItemStyle-HorizontalAlign="center" >
<ItemTemplate>
<asp:Label ID="lblRepairEquipmentType" Text='<%# Bind("EquipmentType") %>' runat="server" Enabled="False" Width="220px" />
<asp:label ID="lblRepairType" Text='<%# Bind("RepairType") %>' runat="server" Enabled="False" Width="220px"/>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlRepairEquipmentEdit" runat="server" DataSourceID="SqlDataSourcePartEquipment" DataValueField="RecID" DataTextField="EquipmentPart" SelectedValue='<%# Eval("EquipmentID") %>' AppendDataBoundItems="True" AutoPostBack="True" Width="220px" Height="20px" >
<asp:ListItem Value="0">---SELECT---</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddlRepairEdit" runat="server" DataSourceID="SqlDataSourceRepair" DataValueField="RecID" DataTextField="Description" SelectedValue='<%# Eval("RepairID")%>' AppendDataBoundItems="True" AutoPostBack="true" Width="220px" Height="20px" OnSelectedIndexChanged="ddlRepairEdit_SelectedIndexChanged" />
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddlRepairEquipmentInsert" runat="server" DataSourceID="SqlDataSourcePartEquipment" DataValueField="RecID" DataTextField="EquipmentPart" AppendDataBoundItems="True" AutoPostBack="True" Width="220px" Height="20px" Style="margin-left: 29px" >
<asp:ListItem Value="0">---SELECT---</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddlRepairInsert" runat="server" DataSourceID="SqlDataSourceRepair" DataValueField="RecID" DataTextField="Description" AppendDataBoundItems="True" autopostback="true" Width="220px" Height="20px" OnSelectedIndexChanged="ddlRepairInsert_SelectedIndexChanged" OnDataBinding="ddlRepairInsert_DataBinding">
<asp:ListItem Value="0">---SELECT---</asp:ListItem>
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Repair Hours Requested" ItemStyle-HorizontalAlign="center" HeaderStyle-Width="100px">
<ItemTemplate>
<asp:label ID="lblRepairHours" Text='<%# Bind("RepairHours")%>' runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:textbox ID="txtRepairHoursEdit" Text='<%# Bind("RepairHours")%>' runat="server" Width="95px" />
<%--<asp:Label ID="lblRepairHoursEdit" runat="server"></asp:Label>--%>
<asp:HiddenField runat="server" ID="hidAllowedRepairHoursEdit" Value='<%# Bind("AllowedHours")%>' />
</EditItemTemplate>
<FooterTemplate>
<asp:textbox ID="txtRepairHoursInsert" runat="server" style="width: 100%; box-sizing: border-box;"/>
<%--<center><asp:Label ID="lblRepairHoursInsert" runat="server"></asp:Label></center>--%>
<asp:HiddenField runat="server" ID="hidAllowedRepairHoursInsert" />
</FooterTemplate>
</asp:TemplateField>
<%--<asp:TemplateField HeaderText="Repair Hours Approved" ItemStyle-HorizontalAlign="center" HeaderStyle-Width="100px">
<ItemTemplate>
<asp:label ID="lblAllowedHours" Text='<%# Bind("AllowedHours")%>' runat="server" Width="50px"/>
</ItemTemplate>
<EditItemTemplate>
<asp:textbox ID="txtAllowedHoursEdit" Text='<%# Bind("AllowedHours")%>' Enabled="true" runat="server" Width="50px"/>
</EditItemTemplate>
<FooterTemplate>
<asp:textbox ID="txtAllowedHoursInsert" Text='<%# Bind("AllowedHours")%>' runat="server" style="width: 100%; box-sizing: border-box;"/>
</FooterTemplate>
</asp:TemplateField>--%>
<asp:TemplateField HeaderText="Repair Cost" ItemStyle-HorizontalAlign="center" HeaderStyle-Width="100px">
<ItemTemplate>
<asp:label ID="lblRepairCost" Text='<%# Bind("RepairCost", "{0:C}") %>' runat="server" Enabled="False"/>
</ItemTemplate>
<EditItemTemplate>
<asp:textbox ID="txtRepairCostEdit" Text='<%# Bind("RepairCost") %>' runat="server" ReadOnly="True" Width="95px"/>
</EditItemTemplate>
<FooterTemplate>
<asp:textbox ID="txtRepairCostInsert" Text='<%# Bind("RepairCost") %>' runat="server" ReadOnly="True" style="width: 100%; box-sizing: border-box;"/>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Repair Total" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="100px">
<ItemTemplate>
<asp:label ID="lblRepairTotal" Text='<%# Bind("LaborRequested", "{0:C}")%>' runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:textbox ID="txtRepairTotalEdit" Text='<%# Bind("LaborRequested")%>' Enabled="false" runat="server" Width="95px"/>
</EditItemTemplate>
<FooterTemplate>
<asp:textbox ID="txtRepairTotalInsert" Text='<%# Bind("LaborRequested") %>' runat="server" Enabled="false" style="width: 100%; box-sizing: border-box;"/>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tax" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="100px">
<ItemTemplate>
<asp:LinkButton ID="lbTaxTotal" Text='<%# Bind("Tax", "{0:C}")%>' runat="server" CommandArgument="Repair" OnClick="lblTaxTotal_Click" />
<asp:HiddenField ID="hidRepairGST" runat="server" Value='<%# Bind("GST")%>' />
<asp:HiddenField ID="hidRepairPST" runat="server" Value='<%# Bind("PST")%>' />
<asp:HiddenField ID="hidRepairQST" runat="server" Value='<%# Bind("QST")%>' />
<asp:HiddenField ID="hidRepairHST" runat="server" Value='<%# Bind("HST")%>' />
</ItemTemplate>
<EditItemTemplate>
<asp:textbox ID="lblTaxTotalEdit" Text='<%# Bind("Tax")%>' Enabled="true" runat="server" Width="95px"/>
</EditItemTemplate>
<FooterTemplate>
<asp:textbox ID="txtTaxTotalInsert" runat="server" Enabled="true" text="0" style="width: 100%; box-sizing: border-box;"/>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Insert New" HeaderStyle-Width="85px">
<ItemTemplate>
<asp:Label ID="lblEmpty" Text="" runat="server" Width="85px"/>
</ItemTemplate>
<FooterTemplate>
<asp:Button ID="Insert" runat="server" CommandName="InsertNewDetail" Height="22px" Text="Insert" style="width: 100%; box-sizing: border-box;" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle BackColor="#336699" ForeColor="White" />
</asp:GridView>
<asp:Label runat="server" ID="lblErrorRepair" ForeColor="Red" />
<br />
</asp:Panel>
What I am trying to do with the gridview above is loop through some specific controls on the gridview and store their values in an array. Essentially how this gridview works is the user will enter information into a series of drop down lists and textboxes, as seen above, when the user hits the button at the end of the row (labeled "InsertDetail" and "Insert" respectively, it takes the data from the drop down list and textboxes and stores it in the labels (also above) for simpler display (this goes on for however many items the user needs to enter (usually around 2 - 5 items total)). I need a way to loop through the values in however many iterations of "lblRepairEquipmentType" there are at the time the user hits any of the "insert" buttons and store the value of each iteration of "lblRepairEquipmentType" in an array so that I can use that array to perform other procedures.
Any help would be greatly appreciated and if there is something else I can try that would be better, either efficiency wise or just for best practices I would appreciate and welcome any constructive criticism. Thank you all for your patience and willingness to help.

RequiredValidator is not working in asp.net

I want to validate some text box and dropdownlist control not to empty, like below highlight part:
and my GridView control code looks like below:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="EMPLOYEEID"
DataSourceID="SqlDataSource1" ShowFooter="True">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:TemplateField>
<FooterTemplate>
<asp:LinkButton ID="LinkButton1" runat="server">Insert</asp:LinkButton>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="EMPLOYEEID" SortExpression="EMPLOYEEID">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("EMPLOYEEID") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("EMPLOYEEID") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtInsertEmpID" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvInsertEmpID" ControlToValidate="txtInsertEmpID"
Text="*" ForeColor="Red" ValidationGroup="Insert" runat="server" ErrorMessage="EmployeeID is required" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="NAME" SortExpression="NAME">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("NAME") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvEditName" ControlToValidate="TextBox1" Text="*"
ForeColor="Red" runat="server" ErrorMessage="EmployeeName is required" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("NAME") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtInsertName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvInsertName" ControlToValidate="txtInsertName"
Text="*" ForeColor="Red" ValidationGroup="Insert" runat="server" ErrorMessage="EmployeeName is required" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DEPTID" SortExpression="DEPTID">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" SelectedValue='<%# Bind("DEPTID") %>' runat="server">
<asp:ListItem>Select Department</asp:ListItem>
<asp:ListItem Value="1">SM</asp:ListItem>
<asp:ListItem Value="2">CDS</asp:ListItem>
<asp:ListItem Value="3">AM</asp:ListItem>
<asp:ListItem Value="4">FS</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvEditDept" ControlToValidate="DropDownList1" Text="*"
ForeColor="Red" runat="server" ErrorMessage="Department is required" InitialValue="Select Department" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("DEPTID") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddlInsertDeptID" runat="server">
<asp:ListItem>Select Department</asp:ListItem>
<asp:ListItem Value="1">SM</asp:ListItem>
<asp:ListItem Value="2">CDS</asp:ListItem>
<asp:ListItem Value="3">AM</asp:ListItem>
<asp:ListItem Value="4">FS</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvInsertDept" ControlToValidate="ddlInsertDeptID"
Text="*" ForeColor="Red" ValidationGroup="Insert" runat="server" ErrorMessage="Department is required"
InitialValue="Select Department" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="Insert"
ForeColor="Blue" />
<asp:ValidationSummary ID="ValidationSummary2" runat="server" ForeColor="Red" />
I'm not sure what's the problem so that when I click Insert link button the page was submitted without any error message even though I don't type anything in the bottom of text boxes.
can anybody help me?
You are just Missing Validation Group in Insert LinkButton.
<asp:LinkButton ID="LinkButton1" runat="server" ValidationGroup="Insert">Insert</asp:LinkButton>
Please use following code for required field by removing your
InitialValue="Select Department" and ErrorMessage="Department is required"
<asp:RequiredFieldValidator ID="rfvInsertDept" ControlToValidate="ddlInsertDeptID" Text="*" ForeColor="Red" ValidationGroup="Insert" runat="server">Department is required</asp:RequiredFieldValidator>

select all checkboxes using one checkbox in datalist

this is my code when i click on checkbox chkall , all checkboxes should be activated.
so can please anyone help me
<asp:DataList ID="DataList1" runat="server" OnItemCommand="DataList1_ItemCommand" CellPadding="4" ForeColor="#333333">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderTemplate>
<asp:CheckBox ID="chkall" runat="server" onclick="checktrue()" />
EMPID ENAME DESIGNATION DOJ SALARY DEPTNO Edit/Update
</HeaderTemplate>
<ItemStyle BackColor="#EFF3FB" />
<ItemTemplate>
<asp:CheckBox ID="chkone" runat="server" />
<asp:Label ID="lblempid" runat="server" Text='<%#Eval("empid") %>' />
<%#Eval("ename") %>
<%#Eval("desg") %>
<%#Eval("doj") %>
<%#Eval("salary") %>
<%#Eval("deptno") %>
<asp:Button ID="btnedit" runat="server" Text="EDIT" CommandName="Edit" />
</ItemTemplate>
<AlternatingItemStyle BackColor="White" />
<EditItemTemplate>
<asp:Label ID="lblempid" runat="server" Text='<%#Eval("empid") %>' />
<asp:TextBox ID="txtename" runat="server" Text='<%#Eval("ename") %>' />
<asp:TextBox ID="txtdesg" runat="server" Text='<%#Eval("desg") %>' />
<asp:TextBox ID="txtdoj" runat="server" Text='<%#Eval("doj") %>' />
<asp:TextBox ID="txtsalary" runat="server" Text='<%#Eval("salary") %>' />
<asp:TextBox ID="txtdeptno" runat="server" Text='<%#Eval("deptno") %>' />
<asp:Button ID="btnupdate" runat="server" Text="Update" CommandName="Update" />
<asp:Button ID="btncancel" runat="server" Text="Cancel" CommandName="Cancel" />
</EditItemTemplate>
<FooterTemplate>
<asp:Button ID="btmdelete" runat="server" OnClick="btndelete_Click" Text="Delete" />
<asp:TextBox ID="txtempid" runat="server" Width="60"></asp:TextBox>
<asp:TextBox ID="txtename" runat="server" Width="60"></asp:TextBox>
<asp:TextBox ID="txtdesg" runat="server" Width="60"></asp:TextBox>
<asp:TextBox ID="txtdoj" runat="server" Width="60"></asp:TextBox>
<asp:TextBox ID="txtsalary" runat="server" Width="60"></asp:TextBox>
<asp:TextBox ID="txtdeptno" runat="server" Width="60"></asp:TextBox>
<asp:Button ID="btnadd" runat="server" Text="add" CommandArgument="add" />
</FooterTemplate>
<SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
</asp:DataList>
I recommend doing it on the client side. Here is an example with jquery
function checkAll(){
$("#DataList1 :checkbox").prop("checked", $("#chkall").prop("checked"));
}

gridview paging alignment issue in Chrome and Mozilla

I have a gridview control with paging. Everything is good in IE.
But in Firefox and Chrome, the design breaks because of paging.
I attach the screenshots from IE and Firefox here:
In IE:
In Firefox:
Here is my grid view:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderWidth="0"
AllowPaging="true" ShowFooter="true" PageSize="3" Width="100%" OnPageIndexChanging="GridView1_PageIndexChanging"
OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing"
OnRowUpdating="GridView1_RowUpdating"
OnRowDeleting="GridView1_RowDeleting" OnRowCommand="GridView1_RowCommand" HorizontalAlign="Center">
<AlternatingRowStyle CssClass="gridAlternateRow" />
<FooterStyle CssClass="gridFooter" />
<PagerSettings Mode="NumericFirstLast" />
<PagerStyle HorizontalAlign="Center" CssClass="GridPager" VerticalAlign="Middle" Wrap="False" />
<HeaderStyle CssClass="GridHeader" />
<RowStyle CssClass="gridRow" />
<Columns>
<asp:TemplateField HeaderText="ID" Visible="false">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lbladd" runat="server"></asp:Label>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="From Date" HeaderStyle-Width="10%">
<ItemTemplate>
<asp:Label ID="lblFromDate" runat="server" Text='<%#Eval("FromDate") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox CssClass="myCalCss" ID="txtFromDate" runat="server" Text='<%#Eval("FromDate") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox CssClass="myCalCss" ID="txtAddFromDate" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqFromDate" ValidationGroup="ValgrpConUNIAnesthesiaFeeSchedule" ControlToValidate="txtAddFromDate" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
</FooterTemplate>
<HeaderStyle Width="15%"></HeaderStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="To Date" HeaderStyle-Width="15%">
<ItemTemplate>
<asp:Label ID="lblToDate" runat="server" Text='<%#Eval("ToDate") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox CssClass="myCalCss" ID="txtToDate" runat="server" Text='<%#Eval("ToDate") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox CssClass="myCalCss" ID="txtAddToDate" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqToDate" ValidationGroup="ValgrpConUNIAnesthesiaFeeSchedule" ControlToValidate="txtAddToDate" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
</FooterTemplate>
<HeaderStyle Width="15%"></HeaderStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Procedure Code" HeaderStyle-Width="15%">
<ItemTemplate>
<asp:Label ID="lblProcedureCode" runat="server" Text='<%#Eval("ProcedureCode") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtProcedureCode" runat="server" Text='<%#Eval("ProcedureCode") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtAddProcedureCode" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqProcedureCode" ValidationGroup="ValgrpConUNIAnesthesiaFeeSchedule" ControlToValidate="txtAddProcedureCode" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
</FooterTemplate>
<HeaderStyle Width="15%"></HeaderStyle>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Width="15%">
<ItemTemplate>
<span onclick="return confirm('Are you sure want to delete?')">
<asp:LinkButton CssClass="aDelete" ID="btnDelete" Text="Delete" runat="server" CommandName="Delete" />
</span>
<asp:LinkButton ID="btnEdit" Text="Edit" runat="server" CommandName="Edit" CssClass="aEdit" />
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="btnUpdate" Text="Update" runat="server" CommandName="Update" CssClass="aUpdate" />
<asp:LinkButton ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel" CssClass="aSave" />
</EditItemTemplate>
<FooterTemplate>
<asp:Button ID="btnInsertRecord" runat="server" Text="Add" ValidationGroup="ValgrpConUNIAnesthesiaFeeSchedule" CommandName="Insert" />
</FooterTemplate>
<HeaderStyle Width="15%"></HeaderStyle>
</asp:TemplateField>
</Columns>
</asp:GridView>
I take a look at Firebug and this is what I got in both IE and Firefox. Same HTML.
What am I missing?

ASP.NET Web application performs slow in client PC

I am developing a ASP.NET web application. One of my from perform very slow in client machine. Where I use GridView which include some function and some control on there like combo-box input box, each control have some function and calculation on there leave.
Please suggest me how can I improve this?
Page on content.
- GridView
1. Combobox with jquery datafiltering
2. Inputbox with data check function
3. More function of grid like update,add, new, delete.
I am also use Viewsate on this page.
<%# Page Title="" Language="C#" MasterPageFile="~/UI/Healthcare.Master" AutoEventWireup="true" CodeBehind="frmStockIn.aspx.cs" Inherits="Com.Codespecies.Healthcare.UI.Pharmacy.frmStockIn" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder_header" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
...........
....
....
<div class="box_bg" style="height: auto; width: 1020px; border: 0px solid; border-color: #0167AA; margin:5px 0px 0px 0px; float:left;">
<div style=" min-height:30px; width: 1005px; padding: 0px 0px 0px 2px;">
<div style="min-height: 30px; width:auto; width:300px; float: left; font-weight: bold;">
Drugs Details
</div>
<div style="min-height: 30px; width: 600px; float: left;">
<div id="msg" style="height:auto; float:left;">
<asp:Label ID="lblMsg" runat="server" Text=" "></asp:Label>
</div>
<div id="ajaxLoader" style=" display:none; margin:2px 0px 0px 0px; float:left;">
<img height="20px" width="20px" src="../../image/ajax-loading/ajax-loading-2.gif" alt="loader" border="0" style=""/>
</div>
</div>
</div>
<div style=" width: auto; padding: 0px 0px 5px 0px;">
<asp:GridView ID="gvStockIn" runat="server" AllowPaging="True" Width="1020px"
AlternatingRowStyle-HorizontalAlign="Left" AlternatingRowStyle-VerticalAlign="Middle"
AutoGenerateColumns="False" BorderStyle="None" DataKeyNames="ID"
Font-Names="Calibri" Font-Size="Small" ForeColor="#333333" GridLines="None"
PageSize="100" ShowFooter="True" ShowHeaderWhenEmpty="True"
onrowcancelingedit="gvStockIn_RowCancelingEdit" onrowcommand="gvStockIn_RowCommand"
onrowdeleting="gvStockIn_RowDeleting" onrowediting="gvStockIn_RowEditing"
onrowupdating="gvStockIn_RowUpdating" onrowdatabound="gvStockIn_RowDataBound"
AllowSorting="True" TabIndex="5">
<AlternatingRowStyle BackColor="#DCEEFC" Font-Names="Calibri" HorizontalAlign="Left" VerticalAlign="Middle" />
<Columns>
<asp:TemplateField HeaderText="SL" SortExpression="ID">
<ItemStyle Width="30px" />
<HeaderStyle Width="30px" />
<FooterStyle Width="30px" />
<EditItemTemplate>
<asp:Label ID="lblSerialNo" runat="server" Text='<%# Eval("ID") %>' Width="30px"></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:Label ID="lblNewSerialNo" runat="server" Width="30px">NA</asp:Label>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblSerialNo" runat="server" Text='<%# Bind("ID") %>' Width="30px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Drug" >
<ItemStyle Width="170px" />
<HeaderStyle Width="170px" />
<FooterStyle Width="170px" />
<EditItemTemplate>
<asp:Label ID="lblDrug" runat="server" Text='<%# Bind("DRUG_NAME") %>' Width="170px"></asp:Label>
<%--<asp:TextBox ID="txtDrug" runat="server" CssClass="Drug" Text='<%# Eval("DRUG_NAME") %>' Width="100px"></asp:TextBox>--%>
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList CssClass="fire_selected_change_event combobox combobox1" ID="ddlNewDrug" runat="server" onselectedindexchanged="ddlNewDrug_SelectedIndexChanged">
</asp:DropDownList>
<%--<asp:TextBox ID="txtNewDrug" runat="server" CssClass="Drug" Width="100px"></asp:TextBox>--%>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblDrug" runat="server" Text='<%# Bind("DRUG_NAME") %>' Width="170px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Presentation">
<ItemStyle Width="130px" />
<HeaderStyle Width="130px" />
<FooterStyle Width="130px" CssClass="drug_list1"/>
<EditItemTemplate>
<asp:Label ID="lblPresentation" runat="server" Text='<%# Bind("PRESENTATION_NAME") %>' Width="130px"></asp:Label>
<%--<asp:TextBox ID="txtPresentation" runat="server" CssClass="Presentation" Text='<%# Eval("PRESENTATION_NAME") %>' Width="110px"></asp:TextBox>--%>
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList CssClass="fire_selected_change_event combobox combobox1" ID="ddlNewPresentation" runat="server" AutoPostBack="True" onselectedindexchanged="ddlNewPresentation_SelectedIndexChanged">
</asp:DropDownList>
<%--<asp:TextBox ID="txtNewPresentation" runat="server" CssClass="Presentation" Width="110px"></asp:TextBox>--%>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblPresentation" runat="server" Text='<%# Bind("PRESENTATION_NAME") %>' Width="130px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Unit Strength">
<ItemStyle Width="130px" />
<HeaderStyle Width="130px" />
<FooterStyle Width="130px" CssClass="drug_list1"/>
<EditItemTemplate>
<asp:Label ID="lblUnitStrength" runat="server" Text='<%# Bind("DRUG_UNIT_STRENGTH") %>' Width="110px"></asp:Label>
<%--<asp:TextBox ID="txtUnitStrength" runat="server" CssClass="UnitStrength" Text='<%# Eval("DRUG_UNIT_STRENGTH") %>' Width="110px"></asp:TextBox>--%>
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList CssClass="fire_selected_change_event combobox combobox1" ID="ddlNewUnitStrength" runat="server" AutoPostBack="True" onselectedindexchanged="ddlNewUnitStrength_SelectedIndexChanged">
</asp:DropDownList>
<%--<asp:TextBox ID="txtNewUnitStrength" runat="server" CssClass="UnitStrength" Width="110px"></asp:TextBox>--%>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblUnitStrength" runat="server" Text='<%# Bind("DRUG_UNIT_STRENGTH") %>' Width="110px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Mfg Date">
<ItemStyle Width="65px" />
<HeaderStyle Width="65px" />
<FooterStyle Width="65px" />
<EditItemTemplate>
<asp:TextBox ID="txtManufacturerDate" runat="server" CssClass="date_property" Text='<%# Eval("DRUG_MANUFACTURER_DATE", "{0:dd/MM/yyyy}") %>' Height="25px" Width="65px"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewManufacturerDate" runat="server" CssClass="date_property" Height="25px" Width="65px"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblManufacturerDate" runat="server" Text='<%# Bind("DRUG_MANUFACTURER_DATE", "{0:dd/MM/yyyy}") %>' Height="25px" Width="65px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Exp. Date">
<ItemStyle Width="65px" />
<HeaderStyle Width="65px" />
<FooterStyle Width="65px" />
<EditItemTemplate>
<asp:TextBox ID="txtExpireDate" runat="server" CssClass="date_property" Text='<%# Eval("DRUG_EXPIRE_DATE", "{0:dd/MM/yyyy}") %>' Height="25px" Width="65px"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewExpireDate" runat="server" CssClass="date_property" Height="25px" Width="65px"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblExpireDate" runat="server" Text='<%# Bind("DRUG_EXPIRE_DATE", "{0:dd/MM/yyyy}") %>' Height="25px" Width="65px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Qty">
<ItemStyle Width="40px" HorizontalAlign="Right" />
<HeaderStyle Width="40px" HorizontalAlign="Right" />
<FooterStyle Width="40px" HorizontalAlign="Right" />
<EditItemTemplate>
<asp:TextBox ID="txtQuantity" runat="server" CssClass="check_decimal Quantity" Text='<%# Eval("QUANTITY") %>' Height="25px" Width="40px"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewQuantity" runat="server" CssClass="check_decimal Quantity" Height="25px" Width="40px"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblQuantity" runat="server" Text='<%# Bind("QUANTITY") %>' Height="25px" Width="40px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cost Price">
<ItemStyle Width="70px" HorizontalAlign="Right"/>
<HeaderStyle Width="70px" HorizontalAlign="Right"/>
<FooterStyle Width="70px" HorizontalAlign="Right"/>
<EditItemTemplate>
<asp:TextBox ID="txtCostPrice" runat="server" CssClass="check_decimal CostPrice" Text='<%# Eval("COST_PRICE") %>' ontextchanged="txtCostPrice_TextChanged" AutoPostBack="true" Height="25px" Width="60px"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewCostPrice" runat="server" CssClass="check_decimal CostPrice" ontextchanged="txtNewCostPrice_TextChanged" AutoPostBack="true" Height="25px" Width="60px"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblCostPrice" runat="server" Text='<%# Bind("COST_PRICE") %>' Height="25px" Width="60px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sale Price">
<ItemStyle Width="70px" HorizontalAlign="Right"/>
<HeaderStyle Width="70px" HorizontalAlign="Right"/>
<FooterStyle Width="70px" HorizontalAlign="Right"/>
<EditItemTemplate>
<asp:TextBox ID="txtSellPrice" runat="server" CssClass="check_decimal SellPrice" Text='<%# Eval("SELL_PRICE") %>' Height="25px" Width="60px"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewSellPrice" runat="server" CssClass="check_decimal SellPrice" Height="25px" Width="60px"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblSellPrice" runat="server" Text='<%# Bind("SELL_PRICE") %>' Height="25px" Width="60px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Discount">
<ItemStyle Width="60px" HorizontalAlign="Right"/>
<HeaderStyle Width="60px" HorizontalAlign="Right"/>
<FooterStyle Width="60px" HorizontalAlign="Right"/>
<EditItemTemplate>
<asp:TextBox ID="txtDiscount" runat="server" CssClass="check_decimal percentage" Text='<%# Eval("DISCOUNT") %>' Height="25px" Width="60px"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewDiscount" runat="server" CssClass="check_decimal percentage" Height="25px" Width="60px"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblDiscount" runat="server" Text='<%# Bind("DISCOUNT") %>' Height="25px" Width="60px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sub Total">
<ItemStyle Width="70px" HorizontalAlign="Right"/>
<HeaderStyle Width="70px" HorizontalAlign="Right"/>
<FooterStyle Width="70px" HorizontalAlign="Right"/>
<EditItemTemplate>
<asp:TextBox ID="txtSubTotal" runat="server" CssClass="check_decimal" Text='<%# Eval("SUB_TOTAL_AMOUNT") %>' ontextchanged="txtSubTotal_TextChanged" AutoPostBack="true" Height="25px" Width="70px"></asp:TextBox>
<%--<asp:Label ID="lblSubTotal" runat="server" Text='<%# Eval("SUB_TOTAL_AMOUNT") %>' Height="25px" Width="80px"></asp:Label>--%>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewSubTotal" runat="server" CssClass="check_decimal" Text='' ontextchanged="txtNewSubTotal_TextChanged" AutoPostBack="true" Height="25px" Width="70px"></asp:TextBox>
<%--<asp:Label ID="lblSubTotal" runat="server" Text='' Height="25px" Width="80px"></asp:Label>--%>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblSubTotal" runat="server" Text='<%# Bind("SUB_TOTAL_AMOUNT") %>' Height="25px" Width="70px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action" ShowHeader="False">
<ItemStyle Width="100px" HorizontalAlign="Center"/>
<HeaderStyle Width="100px" HorizontalAlign="Center"/>
<FooterStyle Width="100px" HorizontalAlign="Center"/>
<EditItemTemplate>
<asp:ImageButton ID="lnkUpdate" ToolTip="Update" runat="server" OnClientClick="load_ajax_drugs_details();" ImageUrl="../../image/update.png" Height="25px" Width="25px" CausesValidation="False" CommandArgument="" CommandName="Update" ></asp:ImageButton>
<asp:ImageButton ID="lnkCancel" ToolTip="Cancel" runat="server" OnClientClick="load_ajax_drugs_details();" ImageUrl="../../image/cancel.png" Height="25px" Width="25px" CausesValidation="False" CommandArgument="" CommandName="Cancel" ></asp:ImageButton>
<%-- <asp:LinkButton ID="lnkUpdate" runat="server" CausesValidation="False" OnClientClick="load_ajax_drugs_details();" CommandName="Update" Text="Update"></asp:LinkButton>
<asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" OnClientClick="load_ajax_drugs_details();" CommandName="Cancel" Text="Cancel"></asp:LinkButton>--%>
</EditItemTemplate>
<FooterTemplate>
<asp:ImageButton ID="lnkNew" ToolTip="New" runat="server" OnClientClick="load_ajax_drugs_details();" ImageUrl="../../image/add.png" Height="25px" Width="25px" CausesValidation="False" CommandArgument="" CommandName="New" ></asp:ImageButton>
<asp:ImageButton ID="lnkRefresh" ToolTip="Refresh" runat="server" OnClientClick="load_ajax_drugs_details();" ImageUrl="../../image/refresh.png" Height="25px" Width="25px" CausesValidation="False" CommandArgument="" CommandName="Refresh" ></asp:ImageButton>
</FooterTemplate>
<ItemTemplate>
<asp:ImageButton ID="lnkEdit" ToolTip="Edit" runat="server" OnClientClick="load_ajax_drugs_details();" ImageUrl="../../image/edit.png" Height="25px" Width="25px" CausesValidation="False" CommandArgument="" CommandName="Edit" ></asp:ImageButton>
<%--<asp:LinkButton ID="lnkEdit" ToolTip="Edit" runat="server" OnClientClick="load_ajax_drugs_details();" ImageUrl="../../image/edit.png" Height="10px" Width="15px" CausesValidation="False" CommandArgument="" CommandName="Edit" Text="Edit"></asp:LinkButton>--%>
<asp:ImageButton ID="lnkDelete" ToolTip="Delete" runat="server" OnClientClick="load_ajax_drugs_details();" ImageUrl="../../image/delete.png" Height="25px" Width="25px" CausesValidation="False" CommandArgument="" CommandName="Delete" ></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle BackColor="#507CD1" ForeColor="White" HorizontalAlign="Left" VerticalAlign="Middle" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Right" VerticalAlign="Middle" />
<RowStyle Font-Names="Calibri" />
<FooterStyle CssClass="drug_list"></FooterStyle>
</asp:GridView>
</div>
.....
.....
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
}
There is a lot of reasons for this issue.As far as i under stood from your question I will suggest some places where you need to take a look at.
1)Check how much data you retrieves from database in order to show the gridview primarily.
2)adding the above controls to the gridview won't make it perform badly.But the calculations you where talking about may be a cause.Take a deep look at the code ,check whether there is any long running loops or some thing else is there.
3)if the first two is not helping you make a profiling.For your problem you just need a trial version of ants performance profiler.
After installing the profile find out which database call or .net function is taking more time to execute then debug it.

Resources