gpt4 book ai didi

c# - asp.net 中的对象数据源

转载 作者:行者123 更新时间:2023-11-30 18:34:20 26 4
gpt4 key购买 nike

我正在使用 Objectdatasource 来填充 GridView 。在 gridview 中,其中一列在数据库中具有加密值。我想在 gridview 中加载列的解密值。

这是gridview和objectdatasource

<asp:GridView ID="GridView1" SkinID="GridView" runat="server" Width="100%" AutoGenerateColumns="False"
AllowPaging="True" PageSize="10" DataSourceID="ObjectDataSource1" AllowSorting="True"
AlternatingRowStyle-BackColor="Silver" HeaderStyle-BackColor="#666666" HeaderStyle-ForeColor="White">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="Taxi_Id" HeaderText="Edit" DataNavigateUrlFormatString="TaxiForm.aspx?ID={0}&E=1"
Text="Edit" />
<asp:BoundField DataField="Taxi_Id" HeaderText="Taxi_Id" SortExpression="Driver_Id"
Visible="False" />
<asp:BoundField DataField="MedallionNo" HeaderText="Medallion No" SortExpression="MeddallionNo" />
<asp:BoundField DataField="Car_Brand_Name" HeaderText="Brand Name" SortExpression="Car_Brand_Name" />
<asp:BoundField DataField="Car_Model_Name" HeaderText="Model Name" SortExpression="Car_Model_Name" />
<asp:BoundField DataField="Car_Year" HeaderText="Year" SortExpression="Car_Year" />
<asp:BoundField DataField="Affiliation_Name" HeaderText="Affiliation" SortExpression="Affiliation_Name" />
<asp:BoundField DataField="Mileage" HeaderText="Mileage" SortExpression="Mileage" />
<asp:BoundField DataField="Taxi_Company_Garage_Name" HeaderText="PickUp Location" SortExpression="Taxi_Company_Garage_Name" />
<asp:HyperLinkField DataNavigateUrlFields="Taxi_Id" HeaderText="Shift Rate" DataNavigateUrlFormatString="TaxiShiftRateList.aspx?ID={0}&E=1" Text="View Shift Rate" />
</Columns>
</asp:GridView>


<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="Owner_GetAll" TypeName="TMS.TaxiObj" >
<DeleteParameters>
<asp:Parameter Name="Driver_Id" Type="Int32" />
</DeleteParameters>
<SelectParameters>
<asp:ControlParameter ControlID="txtMedallionNo" Name="MedallionNo" PropertyName="Text"
Type="String" DefaultValue="" />
<asp:ControlParameter ControlID="ddlBrand" Name="Car_Brand_Id" PropertyName="Text"
Type="Int32" DefaultValue="-1" />
<asp:ControlParameter ControlID="ddlModel" Name="Car_Model_Id" PropertyName="Text"
Type="Int32" DefaultValue="-1" />
<asp:ControlParameter ControlID="ddlAffiliation" Name="Affiliation_Id" PropertyName="Text"
Type="Int32" DefaultValue="-1" />
</SelectParameters>
</asp:ObjectDataSource>

最佳答案

<asp:TemplateField HeaderText="SomeField" SortExpression="SomeField">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Decrypt(Eval("SomeField").ToString()) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

关于c# - asp.net 中的对象数据源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16195954/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com