您的位置:首页 > 移动开发 > Objective-C

objectdatasource sample

2008-03-27 22:26 260 查看
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

<h1>

Event Search</h1>

<ajax:ScriptManager ID="ScriptManager1" runat="server">

</ajax:ScriptManager>

<div class="CommonContent">

<ajax:UpdatePanel ID="SearchPane" runat="server">

<ContentTemplate>

<table>

<tr>

<td>

<asp:Label runat="server" ID="lblMessage" ForeColor="red"></asp:Label>

</td>

</tr>

<tr>

<td>

<asp:Label runat="Server" ID="lblDate" CssClass="eventSearchPageLabel1">Date:</asp:Label>

<asp:TextBox runat="Server" ID="txtDate" CssClass="eventSearchPageTextBox1"></asp:TextBox>

<ajaxControlToolkit:CalendarExtender runat="server" ID="ceDate" TargetControlID="txtDate"

Format="MMMM d, yyyy">

</ajaxControlToolkit:CalendarExtender>

</td>

<td>

<asp:Label runat="Server" ID="lblEventName" CssClass="eventSearchPageLabel2">Event:</asp:Label>

<asp:TextBox runat="Server" ID="txtEventName" CssClass="eventSearchPageTextBox2"></asp:TextBox>

</td>

</tr>

<tr>

<td>

<asp:SqlDataSource ConnectionString="<%$ ConnectionStrings:ConnectionInfo %>" SelectCommand="

select

TrackID,

TrackName

from Track

" ID="sdsTrack" runat="Server"></asp:SqlDataSource>

<asp:Label runat="Server" ID="lblTrack" CssClass="eventSearchPageLabel1">Venue:</asp:Label>

<asp:DropDownList DataTextField="TrackName" DataValueField="TrackID" DataSourceID="sdsTrack"

runat="server" ID="ddlTrack" CssClass="eventSearchPageDropDownList1" AutoPostBack="True"

OnDataBound="ddlTrack_DataBound">

</asp:DropDownList>

</td>

<td>

<asp:Label runat="Server" ID="lblEventType" CssClass="eventSearchPageLabel2">Discipline:</asp:Label>

<asp:DropDownList runat="Server" ID="ddlDiscipline" CssClass="eventSearchPageDropDownList2"

AutoPostBack="True">

</asp:DropDownList>

</td>

</tr>

<tr>

<td>

<asp:Label runat="Server" ID="lblTraining" CssClass="eventSearchPageLabel1">Training:</asp:Label>

<asp:CheckBox runat="Server" ID="cbTraining" CssClass="eventSearchPageCheckBox1"

Checked="True" />

</td>

<td>

<asp:Label runat="Server" ID="lblCompetition" CssClass="eventSearchPageLabel2">Competition:</asp:Label>

<asp:CheckBox runat="Server" ID="cbCompetition" CssClass="eventSearchPageCheckBox2"

Checked="True" />

</td>

</tr>

<tr>

<td>

<asp:Button runat="Server" ID="btnSearch" Text="Search" OnClick="btnSearch_Click" />

</td>

</tr>

</table>

<asp:ObjectDataSource TypeName="Entities.EntityForEventSearchPage" runat="Server"

SelectMethod="SelectMethod" SortParameterName="SortParameter" ID="odsEvent" OnSelecting="odsEvent_Selecting">

<SelectParameters>

<asp:Parameter Name="EventID" Type="Int32" />

<asp:ControlParameter ControlID="txtDate" Type="DateTime" Name="Date" PropertyName="Text" />

<asp:ControlParameter ControlID="ddlDiscipline" Type="String" Name="Discipline" PropertyName="SelectedValue" />

<asp:ControlParameter ControlID="cbTraining" Type="Boolean" Name="Training" PropertyName="Checked" />

<asp:ControlParameter ControlID="cbCompetition" Type="Boolean" Name="Competition"

PropertyName="Checked" />

<asp:ControlParameter ControlID="txtEventName" Type="String" Name="EventTitle" PropertyName="Text" />

<asp:ControlParameter ControlID="ddlTrack" Type="String" Name="TrackID" PropertyName="SelectedValue" />

<asp:Parameter Name="SortParameter" Type="string" DefaultValue="EventID" />

</SelectParameters>

</asp:ObjectDataSource>

<asp:GridView ID="gvEvent" AutoGenerateColumns="false" DataKeyNames="EventID" runat="server"

AlternatingRowStyle-BackColor="#eeeeee" RowStyle-BackColor="white" RowStyle-BorderColor="#dddddd"

RowStyle-BorderWidth="1" RowStyle-BorderStyle="Solid" BorderColor="#dddddd" BorderWidth="1"

CellPadding="5" CellSpacing="0" AllowSorting="true" OnRowDataBound="gvEvent_RowDataBound">

<Columns>

<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Event" SortExpression="EventTitle">

<ItemTemplate>

<asp:HyperLink runat="Server" ID="hlEventName"></asp:HyperLink>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Date" SortExpression="Date">

<ItemTemplate>

<asp:Label runat="server" ID="lblDate">

</asp:Label>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Discipline" SortExpression="Discipline">

<ItemTemplate>

<asp:Label runat="Server" ID="lblEventType">

</asp:Label>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Training" SortExpression="Training">

<ItemTemplate>

<asp:Label runat="Server" ID="lblTraining">

</asp:Label>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Competition" SortExpression="Training">

<ItemTemplate>

<asp:Label runat="server" ID="lblCompetition">

</asp:Label>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Venue" SortExpression="TrackName">

<ItemTemplate>

<asp:Label runat="server" ID="lblTrackName">

</asp:Label>

</ItemTemplate>

</asp:TemplateField>

</Columns>

</asp:GridView>

</ContentTemplate>

</ajax:UpdatePanel>

</div>

</asp:Content>

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using Entities;

using DAO;

using DomainObjects;

using System.Data.SqlClient;

public partial class EventSearch : System.Web.UI.Page
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: