如何在asp.net中使用call函数对gridview进行排序 [英] how sort filed gridview with call function in asp.net
本文介绍了如何在asp.net中使用call函数对gridview进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在asp.net中使用call函数对gridview进行排序
请参阅样本
how sort filed gridview with call function in asp.net
please see in sample
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowSorting="True" DataKeyNames="FUserId" OnSorting="GVAS_Sorting" CssClass="GridViewStyle" DataSourceID="SqlDataSource1" Height="103px" Width="511px" ShowFooter="True" OnRowDataBound="GridView1_RowDataBound">
<AlternatingRowStyle CssClass="AltRowStyle" />
<Columns>
<asp:TemplateField HeaderText="مجموع حقوق" SortExpression="SumWage">
<ItemTemplate>
<asp:Label ID="lSumWage" Font-Underline="false" runat="server"
Text='<%# SumWage() %>' />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
<FooterTemplate>
<asp:Label ID="lbSumWage" runat="server" Text="Label"></asp:Label>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="نام کاربر">
<ItemTemplate>
<asp:Label ID="fullNAME" Font-Underline="false" runat="server"
Text='<%# TempFullName() %>' />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ICTPortalDBConnectionString %>" SelectCommand="SELECT FFamily,FName,FUserId From Tuser "></asp:SqlDataSource>
public string SumWage()
{
//
return temp.retpricereq(u2,str).ToString();
}
如何排序SortExpression =SumWagesumwage()
how sort with SortExpression="SumWage" sumwage()
推荐答案
ConnectionStrings:ICTPortalDBConnectionString%> SelectCommand = 选择FFamily,FName,FUserId来自Tuser > ; < / asp:SqlDataSource > ;
ConnectionStrings:ICTPortalDBConnectionString %>" SelectCommand="SELECT FFamily,FName,FUserId From Tuser "></asp:SqlDataSource>
public string SumWage()
{
//
return temp.retpricereq(u2,str).ToString();
}
如何排序SortExpression =SumWagesumwage()
how sort with SortExpression="SumWage" sumwage()
您可以将您的方法更改为静态方法,例如
You can change your mathod to a static method like
public static string SumWage()
{
//
return temp.retpricereq(u2,str).ToString();
}
然后使用类似
Then use like
Text='<%# Class.SumWage() %>'
//班级是你的班级SumWage方法驻留。
希望这有帮助......
// Class is the Class where your SumWage Method resides.
Hope this helps...
这篇关于如何在asp.net中使用call函数对gridview进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文