Santhonabin

Santhonabin

  • NA
  • 51
  • 213.1k

Sorting Problem on GridView

Feb 19 2011 1:50 AM
Hi..

if i Click column header for sorting then i received forllowing Error..

Error:The GridView 'GridView1' fired event Sorting which wasn't handled.

Pls any one help to recover this..

Source:

<


div style=" position :absolute; left :322px; top:104px;bottom :50; width: 1053px; height: 264px;"><asp:GridView ID="GridView1" runat="server" BackColor="#CCCCCC" BorderColor="#999999"


BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" ForeColor="Black"






OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowDeleting="GridView1_RowDeleting" AutoGenerateColumns="false" AllowPaging="True" AllowSorting="True">


<FooterStyle BackColor="#CCCCCC" />


<RowStyle BackColor="White" />


<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />


<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />



<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White"/> <Columns>


<asp:TemplateField HeaderText="employer ID" SortExpression="emp_id">


<ItemTemplate>



<asp:Label ID="emp_id" runat="server" text ='<%# Eval("emp_id") %>'>


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:Label ID="emp_id1" runat="server" text ='<%# Eval("emp_id") %>'>


</asp:Label>


</EditItemTemplate>


</asp:TemplateField>



<asp:TemplateField HeaderText="Name" SortExpression="first_name">


<ItemTemplate>



<asp:Label ID="first_name" runat="server" text ='<%# Eval("first_name") %>'>


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:Label ID="first_name1" runat="server" text ='<%# Eval("first_name") %>'>


</asp:Label>


</EditItemTemplate>



</asp:TemplateField> <asp:TemplateField HeaderText="Reported date" SortExpression="report_date">


<ItemTemplate>



<asp:Label ID="report_date" runat="server" text ='<%# Eval("report_date") %>'>


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:Label ID="report_date1" runat="server" text ='<%# Eval("report_date") %>'>


</asp:Label>


</EditItemTemplate>


</asp:TemplateField>


<asp:TemplateField HeaderText="number of days" SortExpression="no_of_days">


<ItemTemplate>



<asp:Label ID="no_of_days" runat="server" text ='<%# Eval("no_of_days") %>' >


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:Label ID="no_of_days1" runat="server" text ='<%# Eval("no_of_days")%>'>



</asp:Label> </EditItemTemplate>



</asp:TemplateField> <asp:TemplateField HeaderText="Leave From" SortExpression="leave_from">


<ItemTemplate>



<asp:Label ID="leave_from" runat="server" text ='<%# Eval("leave_from") %>' >


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:Label ID="leave_from1" runat="server" text ='<%# Eval("leave_from")%>'>



</asp:Label> </EditItemTemplate>



</asp:TemplateField> <asp:TemplateField HeaderText="Leave To" SortExpression="leave_to">


<ItemTemplate>



<asp:Label ID="leave_to" runat="server" text ='<%# Eval("leave_to") %>' >


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:Label ID="leave_to1" runat="server" text ='<%# Eval("leave_to")%>'>



</asp:Label> </EditItemTemplate>




</asp:TemplateField> <asp:TemplateField HeaderText="Session" SortExpression="session">


<ItemTemplate>



<asp:Label ID="session" runat="server" text ='<%# Eval("session") %>' >


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:Label ID="session1" runat="server" text ='<%# Eval("session")%>'>



</asp:Label> </EditItemTemplate>




</asp:TemplateField> <asp:TemplateField HeaderText="Reason" SortExpression="reason">


<ItemTemplate>



<asp:Label ID="reason" runat="server" text ='<%# Eval("reason") %>' >


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:Label ID="reason1" runat="server" text ='<%# Eval("reason")%>'>



</asp:Label > </EditItemTemplate>


</asp:TemplateField>



<asp:TemplateField HeaderText="Approval Status" SortExpression="approval_status">


<ItemTemplate>



<asp:Label ID="approval_status" runat="server" text ='<%# Eval("approval_status") %>' >


</asp:Label>


</ItemTemplate>


<EditItemTemplate >


<asp:DropDownList ID="approval_status1" runat="server" >



<asp:ListItem Selected ="true" Text="** Please Select **" Value="** Please Select **" ></asp:ListItem>


<asp:ListItem Text="Approved" Value="Approved" ></asp:ListItem>


<asp:ListItem Text="Not Approved" Value="Not Approved" ></asp:ListItem>


<asp:ListItem Text="Pending" Value="Pending"></asp:ListItem>



</asp:DropDownList> </EditItemTemplate>


</asp:TemplateField>


<asp:TemplateField HeaderText="Comment" SortExpression="Comment">


<ItemTemplate>



<asp:Label ID="Comment" runat="server" text ='<%# Eval("Comment") %>' >


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:TextBox ID="Comment1" runat="server" text ='<%# Eval("Comment")%>'>



</asp:TextBox> </EditItemTemplate>


</asp:TemplateField>


<asp:TemplateField HeaderText="Approved By" SortExpression="approved_by">


<ItemTemplate>



<asp:Label ID="approved_by" runat="server" text ='<%# Eval("approved_by") %>' >


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:Label ID="approved_by1" runat="server" text ='<%# Eval("approved_by")%>'>



</asp:Label> </EditItemTemplate>


</asp:TemplateField>


<asp:TemplateField HeaderText="Type Of Leave" SortExpression="Type_Of_Leave">


<ItemTemplate>



<asp:Label ID="Type_Of_Leave" runat="server" text ='<%# Eval("Type_Of_Leave") %>' >


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:DropDownList ID="Type_Of_Leave1" runat="server"> <asp:ListItem Selected ="true" Text="** Please Select **" Value="** Please Select **" ></asp:ListItem>


<asp:ListItem Text="SL" Value="SL" ></asp:ListItem>


<asp:ListItem Text="CL" Value="CL" ></asp:ListItem>


<asp:ListItem Text="LOP" Value="LOP"></asp:ListItem>



</asp:DropDownList> </EditItemTemplate>


</asp:TemplateField>


<asp:TemplateField HeaderText="Employee Level" SortExpression="employee_level">


<ItemTemplate>



<asp:Label ID="employee_level" runat="server" text ='<%# Eval("employee_level") %>' >


</asp:Label>


</ItemTemplate>


<EditItemTemplate >



<asp:Label ID="employee_level1" runat="server" text ='<%# Eval("employee_level")%>'>



</asp:Label> </EditItemTemplate>







</asp:TemplateField> <asp:CommandField HeaderText="Edit" ShowEditButton="True" ShowHeader="True" EditImageUrl ="~/icon_edit.gif" ButtonType="Image" CancelImageUrl="~/cancel_Old.gif" UpdateImageUrl="~/update_Old.gif"/> <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" ShowHeader="True" ButtonType="Image" DeleteImageUrl ="~/icon_delete.gif" /> <asp:CommandField HeaderText="Select" ShowSelectButton="True" ShowHeader="True" /> </Columns>


<EmptyDataTemplate>



           No Records</EmptyDataTemplate>


</asp:GridView>


</div>


Answers (1)