hi iam creating a grid view in asp.net 2.0

and iam binding fields in to it:

my problem is:

iam able to sort in ascending order,but wat i need is if i click the header first time it should sort in ascending order and if i click again it should sort in descending order.how can i do that

this is my coding:


<UCC:GridView ID="stepsGrid" runat="server" Width="100%" GridLines="None" EnableViewState="false"

HeaderStyle-CssClass="GridViewHeader" DataKeyNames="TaskID" AllowPaging="true"

PageSize="10" CssClass="GridView" OnPageIndexChanging="StepsGrid_PageIndexChanging"
AllowSorting="true" OnSorting="StepsGrid_Sorting" AutoGenerateColumns="false" >

<AlternatingRowStyle BackColor="#FBF5F6" />

<Columns>

<asp:TemplateField>



<itemtemplate>

<asp:Panel id="popupStep" runat="server" CssClass="pnlpopup" Width="98px"></asp:Panel>

<asp:ImageButton id="stepGridButton" runat="server" HorizontalAlign="Center" ImageUrl="~/Images/CRM/menu_exp_.gif"></asp:ImageButton>
<ACT:PopupControlExtender id="PopupControlExtender3" runat="server" Position="right"

PopupControlID="popupStep" TargetControlID="stepGridButton" DynamicControlID="popupStep"

DynamicContextKey='<%# ReassignStepPopupControl(Eval("TaskID"),Eval("StepName")) %>' DynamicServicePath="WebMethods.aspx"
DynamicServiceMethod="GetUnassignedTeamStepsActions"></ACT:PopupControlExtender>

</itemtemplate>



</asp:TemplateField>

<asp:BoundField HeaderText="Task Type" Sortex-pression="PlanType" DataField="PlanType"/>
<asp:BoundField HeaderText="Client Name" Sortex-pression="ClientName" DataField="ClientName" />

<asp:BoundField HeaderText="Task ID" Sortex-pression="TaskID" DataField="TaskID"/>
<asp:BoundField HeaderText="Task Name" Sortex-pression="PlanName" DataField="PlanName"/>

<asp:BoundField HeaderText="Action Step" Sortex-pression="StepName" DataField="StepName"/>

<asp:BoundField HeaderText="Status Date" Sortex-pression="StatusDate" DataField="StatusDate"/>

<asp:BoundField HeaderText="Status Description" Sortex-pression="StatusDesc" DataField="StatusDesc"/>

<asp:BoundField HeaderText="End Date" Sortex-pression="EstmCompDate" DataField="EstmCompDate"/>

<asp:BoundField HeaderText="Task Owner" Sortex-pression="TaskAssignedTo" DataField="TaskAssignedTo"/>



</Columns>

<PagerStyle CssClass="GridPager" />

<PagerTemplate>

<asp:Button ID="GoFirstPage" runat="server" CommandName="Page" ToolTip="First Page"

CommandArgument="First" CssClass="first" />

<asp:Button ID="PrevPage" runat="server" CommandName="Page" ToolTip="Prev." CommandArgument="Prev"

CssClass="prev" />

<asp:Button ID="NextPage" runat="server" CommandName="Page" ToolTip="Next" CommandArgument="Next"

CssClass="next" />

<asp:Button ID="GoLastPage" runat="server" CommandName="Page" ToolTip="Last Page"

CommandArgument="Last" CssClass="last" />

</PagerTemplate>

<HeaderStyle CssClass="GridViewHeader" />

</UCC:GridView>



and my code behind function is:



private DataView stepsBind()
{

DataTable dtsteps = new DataTable();
DataRow drsteps;

DataView dvsteps;
SvcTask svcTasksStep = new SvcTask();

Steps steps = new Steps();
steps = svcTasksStep.GetUnassignedSteps(Unisys.TM.UICommon.Helper.SessionManager.UserData.UserTeam );

dtsteps.Columns.Add("PlanType");
dtsteps.Columns.Add("ClientName");

dtsteps.Columns.Add("TaskID");
dtsteps.Columns.Add("PlanName");

dtsteps.Columns.Add("StepName");
dtsteps.Columns.Add("StatusDate");

dtsteps.Columns.Add("StatusDesc");
dtsteps.Columns.Add("EstmCompDate");

dtsteps.Columns.Add("TaskAssignedTo");for (int i = 0; i < steps.Count; i++)
{

drsteps = dtsteps.NewRow();

drsteps["PlanType"] = steps[i].PlanType;
drsteps["ClientName"] = steps[i].ClientName;

drsteps["TaskID"] = steps[i].TaskID;
drsteps["PlanName"] = steps[i].PlanName;

drsteps["StepName"] = steps[i].StepName;
drsteps["StatusDate"] = steps[i].StatusDate;

drsteps["StatusDesc"] = steps[i].StatusDesc;
drsteps["EstmCompDate"] = steps[i].EstmCompDate;

drsteps["TaskAssignedTo"] = steps[i].TaskAssignedTo;
dtsteps.Rows.Add(drsteps);

}

if (ViewState["sortExpr"] != null)
{

dvsteps = new DataView(dtsteps);dvsteps.Sort = (string)ViewState["sortExpr"];
}

else

{

dvsteps = dtsteps.DefaultView;

}

return dvsteps;
}







protected void StepsGrid_Sorting(object sender, GridViewSortEventArgs e)
{

ViewState["sortExpr"] = e.Sortex-pression;
stepsGrid.DataSource = stepsBind();

stepsGrid.DataBind();

upSteps.Update();

upStepsRB.Update();

}