当在文本框中输入数据时,我需要根据我的下拉列表、fromdate 和 todate 在网格视图中显示我的数据。我怎样才能做到这一点?到目前为止,我所做的是创建了两个页面。在第一页我有一个下拉列表和一个表格。当我从下拉列表中选择值时,将出现所选值的表单,用户可以在其中输入详细信息并提交该表单。提交后将数据存储在数据库中。在第二页中,我有一个网格视图,其中可以看到存储的值、下拉列表、从日期到日期文本框,现在我想要的是根据我的下拉选择、fromdate 和 todate 在网格视图中显示记录。
第二种形式的代码:
<asp:DropDownList ID="ddlPortal" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlPortal_SelectedIndexChanged">
<asp:ListItem>TRAVELONG</asp:ListItem>
<asp:ListItem>ONETRAVEL</asp:ListItem>
<asp:ListItem>.UK-BSP</asp:ListItem>
<asp:ListItem>.CA-YYZ</asp:ListItem>
<asp:ListItem>.CA-YVR</asp:ListItem>
<asp:ListItem>Partial MCO Refund</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="lbFrom" Text="From" runat="server" /> <asp:TextBox ID="tbFrom" runat="server" />
<asp:Label ID="lblto" Text="To" runat="server" /> <asp:TextBox ID="tbTo" runat="server" />
<asp:Button ID="btnSearch" runat="server" Text="Search"
onclick="btnSearch_Click" />
网格视图详细信息:
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333"
GridLines="None" onrowcommand="GridView1_RowCommand"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateField HeaderText="Query">
<itemtemplate>
<asp:LinkButton CommandName="cmdBind" runat="server" Text='<%#Eval("ID")%>' ID="ID" ToolTip='<%#Eval("ID")%>'>LinkButton
</asp:LinkButton>
</itemtemplate>
</asp:TemplateField>
<asp:BoundField DataField="Portal" HeaderText="Portal" />
<asp:BoundField DataField="TID" HeaderText="TID" />
<asp:BoundField DataField="PNR" HeaderText="PNR" />
<asp:BoundField DataField="TicketNumber" HeaderText="Ticket Number" />
<asp:BoundField DataField="ESACCode" HeaderText="ESACCode" />
<asp:BoundField DataField="WaiverCode" HeaderText="WaiverCode" />
<asp:BoundField DataField="Remarks" HeaderText="Remarks" />
<asp:BoundField DataField="UnusedTicketAmount" HeaderText="UnusedTicketAmount" />
<asp:BoundField DataField="ddlUnusedAmount" HeaderText="ddlUnusedAmount" />
<asp:BoundField DataField="AirlinePenality" HeaderText="AirlinePenality" />
<asp:BoundField DataField="ddlAirlinePenality" HeaderText="ddlAirlinePenality" />
<asp:BoundField DataField="NetRefundProcess" HeaderText="NetRefundProcess" />
<asp:BoundField DataField="ddlNetRefundProcess" HeaderText="ddlNetRefundProcess" />
<asp:BoundField DataField="RefundableCommission" HeaderText="RefundableCommission" />
<asp:BoundField DataField="ddlRefundableCommission" HeaderText="ddlRefundableCommission" />
<asp:BoundField DataField="CouponRefunded" HeaderText="CouponRefunded" />
<asp:BoundField DataField="RefundType" HeaderText="RefundType" />
</Columns>
我想在按钮的单击事件上编写代码,但我不知道如何。你能帮我解决这个问题吗?
.cs 文件:
protected void btnSearch_Click(object sender, EventArgs e)
{
}