【问题标题】:ASP.NET search and display all records from SQL Server with imageASP.NET 使用图像搜索并显示来自 SQL Server 的所有记录
【发布时间】:2017-02-26 10:00:25
【问题描述】:

如何为所有记录创建搜索?我为每条记录都提供了图像,我做到了,但我不知道图像将如何显示。

Picture of my web page

【问题讨论】:

  • 你需要包括你当前的代码,最好还包括你迄今为止尝试过的代码

标签: asp.net sql-server image search


【解决方案1】:
asp:TextBox ID="TextBox1" runat="server" Height="22px"></asp:TextBox><asp:Button ID="Button1"
       runat="server" Text="Search" Height="23px" onclick="Button1_Click1" 
       Width="68px" />
   .<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
       BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" 
       CellPadding="4" DataKeyNames="Plate no رقم اللوحة" 
       DataSourceID="SqlDataSource1" 
       EmptyDataText="There are no data records to display." 
       onselectedindexchanged="GridView1_SelectedIndexChanged1">
       <Columns>
           <asp:BoundField DataField="No الرقم" HeaderText="No الرقم" 
               SortExpression="No الرقم" />
           <asp:BoundField DataField="Plate no رقم اللوحة" 
               HeaderText="Plate no رقم اللوحة" ReadOnly="True" 
               SortExpression="Plate no رقم اللوحة" />
           <asp:BoundField DataField="Type نوع السيارة" HeaderText="Type نوع السيارة" 
               SortExpression="Type نوع السيارة" />
           <asp:BoundField DataField="Year السنة" HeaderText="Year السنة" 
               SortExpression="Year السنة" />
           <asp:BoundField DataField="Colour اللون" HeaderText="Colour اللون" 
               SortExpression="Colour اللون" />
           <asp:BoundField DataField="Owner المالك" HeaderText="Owner المالك" 
               SortExpression="Owner المالك" />
           <asp:BoundField DataField="User المستخدم" HeaderText="User المستخدم" 
               SortExpression="User المستخدم" />
           <asp:BoundField DataField="Location الموقع" HeaderText="Location الموقع" 
               SortExpression="Location الموقع" />
           <asp:BoundField DataField="Status الحاله" HeaderText="Status الحاله" 
               SortExpression="Status الحاله" />
           <asp:BoundField DataField="Orignal أصل الاستمارة" 
               HeaderText="Orignal أصل الاستمارة" SortExpression="Orignal أصل الاستمارة" />
           <asp:BoundField DataField=" License Expiry تاريخ انتهاء الاستمارة" 
               HeaderText=" License Expiry تاريخ انتهاء الاستمارة" 
               SortExpression=" License Expiry تاريخ انتهاء الاستمارة" />
           <asp:BoundField DataField="Insurance Company شركة التامين" 
               HeaderText="Insurance Company شركة التامين" 
               SortExpression="Insurance Company شركة التامين" />
           <asp:BoundField DataField="Insurance Expiry تاريخ انتهاء التامين " 
               HeaderText="Insurance Expiry تاريخ انتهاء التامين " 
               SortExpression="Insurance Expiry تاريخ انتهاء التامين " />
           <asp:BoundField DataField="Spare Keys المفتاح الاحتياطي " 
               HeaderText="Spare Keys المفتاح الاحتياطي " 
               SortExpression="Spare Keys المفتاح الاحتياطي " />
       </Columns>
       <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
       <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
       <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
       <RowStyle BackColor="White" ForeColor="#330099" />
       <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
       <SortedAscendingCellStyle BackColor="#FEFCEB" />
       <SortedAscendingHeaderStyle BackColor="#AF0101" />
       <SortedDescendingCellStyle BackColor="#F6F0C0" />
       <SortedDescendingHeaderStyle BackColor="#7E0000" />
   </asp:GridView>
   <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
       ConnectionString="<%$ ConnectionStrings:All_VechConnectionString1 %>" 
       SelectCommand="SELECT * FROM [ALL_VECH] WHERE (([Plate no رقم اللوحة] LIKE '%' + @Plate_no_رقم_اللوحة + '%') OR ([Type نوع السيارة] LIKE '%' + @Type_نوع_السيارة + '%'))">
       <SelectParameters>
           <asp:ControlParameter ControlID="TextBox1" Name="Plate_no_رقم_اللوحة" 
               PropertyName="Text" Type="String" />
           <asp:ControlParameter ControlID="TextBox1" Name="Type_نوع_السيارة" 
               PropertyName="Text" Type="String" />
       </SelectParameters>
   </asp:SqlDataSource>
</div>

</form>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-03
    • 1970-01-01
    • 1970-01-01
    • 2012-01-06
    • 2012-07-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多