index.aspx:
<form id="form1" runat="server">
<table style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px;
width: 100%; border-top-style: none; padding-top: 0px; border-right-style: none;
border-left-style: none; border-bottom-style: none; background-color: transparent;">
<tr>
<td colspan="4" style="background-image: url(images/sbg.jpg); height: 53px">
<div style="font-size: 22px; color: white; font-family: 隶书; text-align: left">
<nobr>交强险理赔信息简易共享查询系统 <SPAN
style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体-18030">当前用户:中国人民财产保险股份有限公司·管理员|
</SPAN><A href="javascript:window.parent.navigate('Default.aspx')"><FONT
color=white><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体-18030">注
销</SPAN></FONT></A><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体-18030">|
</SPAN><A href="javascript:parent.close()"><FONT color=white><SPAN
style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体-18030">退 出</SPAN></FONT></A>
</nobr>
<nobr></nobr>
<nobr></nobr>
<nobr></nobr>
</div>
</td>
</tr>
<tr>
<td colspan="4" style="height: 17px; background-image: url(images/114_r2_c2.jpg);">
<span style="font-size: 9pt; color: #ffffff;"> 交强险查询
商业险查询 导入数据
导出数据 系统管理</span></td>
</tr>
<tr>
<td colspan="4" style="background-image: url(images/ContainerBGImage2.gif); height: 56px">
<span style="font-size: 9pt"> 保 单 号 <asp:TextBox ID="bdh"
runat="server"></asp:TextBox></span> <span style="font-size: 9pt">车牌号
<asp:TextBox ID="cph" runat="server" Width="150px">贵A55833</asp:TextBox></span><br />
<span style="font-size: 9pt"> 发动机号
<asp:TextBox ID="fdjh" runat="server"></asp:TextBox></span> <span style="font-size: 9pt">
车架号 </span><span style="font-size: 9pt">
<asp:TextBox ID="cjh" runat="server" Width="150px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="查 询" OnClick="Button1_Click1" />
<asp:Button ID="Button2" runat="server" Text="查 询" />
<asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl='index.aspx?bdh=<%this.bdh.Text%>&cph=<%this.cph.Text%>&fdjh=<%this.fdjh.Text%>&cjh=<%this.cjh.Text%>'>LinkButton</asp:LinkButton></span></td>
</tr>
<tr>
<td colspan="4" style="height: 216px">
<table style="width: 100%; height: 100%">
<tr>
<td rowspan="3" style="width: 680px">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="SqlDataSource1"
Height="275px" Width="708px">
<FooterStyle BackColor="White" ForeColor="#000066" />
<Columns>
<asp:BoundField DataField="DeptID" HeaderText="DeptID" SortExpression="DeptID" />
<asp:BoundField DataField="InSuranceMan" HeaderText="InSuranceMan" SortExpression="InSuranceMan" />
<asp:BoundField DataField="InSuranceNo" HeaderText="InSuranceNo" SortExpression="InSuranceNo" />
<asp:BoundField DataField="VehicleNo" HeaderText="VehicleNo" SortExpression="VehicleNo" />
<asp:BoundField DataField="EngineNum" HeaderText="EngineNum" SortExpression="EngineNum" />
<asp:BoundField DataField="DriverNo" HeaderText="DriverNo" SortExpression="DriverNo" />
</Columns>
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:cxlpxxConnectionString %>"
SelectCommand="SELECT [DeptID], [InSuranceMan], [InSuranceNo], [VehicleNo], [EngineNum], [DriverNo] FROM [InSurance] WHERE (([InSuranceNo] = @InSuranceNo) OR ([VehicleNo] = @VehicleNo) OR ([EngineNum] = @EngineNum) OR ([DriverNo] = @DriverNo))">
<SelectParameters>
<asp:FormParameter FormField="bdh" Name="InSuranceNo" Type="String" />
<asp:FormParameter FormField="cph" Name="VehicleNo" Type="String" />
<asp:FormParameter FormField="fdjh" Name="EngineNum" Type="String" />
<asp:FormParameter FormField="cjh" Name="DriverNo" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</td>
<td rowspan="3" style="width: 312px">
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
</table>
</td>
</tr>
</table>
</form>
我的提交按钮需要传递4个回本页面,然后让GridView的查询获取这4个参数并显示记录出来.我不知道该怎么写了.最好是后台处理的.不用js的.比如用Button1_Click1
还有,我在Button1里面加了下面的代码能链接,参数好像没获取.不知道问题在那里,请大家帮忙指导下
protected void Button1_Click1(object sender, EventArgs e)
{
this.Button1.PostBackUrl = "index.aspx?bdh=" + this.bdh.Text + "&cph=" + this.cph.Text + "&fdjh=" + this.fdjh.Text + "&cjh=" + this.cjh.Text;
}
<form id="form1" runat="server">
<table style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px;
width: 100%; border-top-style: none; padding-top: 0px; border-right-style: none;
border-left-style: none; border-bottom-style: none; background-color: transparent;">
<tr>
<td colspan="4" style="background-image: url(images/sbg.jpg); height: 53px">
<div style="font-size: 22px; color: white; font-family: 隶书; text-align: left">
<nobr>交强险理赔信息简易共享查询系统 <SPAN
style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体-18030">当前用户:中国人民财产保险股份有限公司·管理员|
</SPAN><A href="javascript:window.parent.navigate('Default.aspx')"><FONT
color=white><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体-18030">注
销</SPAN></FONT></A><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体-18030">|
</SPAN><A href="javascript:parent.close()"><FONT color=white><SPAN
style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体-18030">退 出</SPAN></FONT></A>
</nobr>
<nobr></nobr>
<nobr></nobr>
<nobr></nobr>
</div>
</td>
</tr>
<tr>
<td colspan="4" style="height: 17px; background-image: url(images/114_r2_c2.jpg);">
<span style="font-size: 9pt; color: #ffffff;"> 交强险查询
商业险查询 导入数据
导出数据 系统管理</span></td>
</tr>
<tr>
<td colspan="4" style="background-image: url(images/ContainerBGImage2.gif); height: 56px">
<span style="font-size: 9pt"> 保 单 号 <asp:TextBox ID="bdh"
runat="server"></asp:TextBox></span> <span style="font-size: 9pt">车牌号
<asp:TextBox ID="cph" runat="server" Width="150px">贵A55833</asp:TextBox></span><br />
<span style="font-size: 9pt"> 发动机号
<asp:TextBox ID="fdjh" runat="server"></asp:TextBox></span> <span style="font-size: 9pt">
车架号 </span><span style="font-size: 9pt">
<asp:TextBox ID="cjh" runat="server" Width="150px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="查 询" OnClick="Button1_Click1" />
<asp:Button ID="Button2" runat="server" Text="查 询" />
<asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl='index.aspx?bdh=<%this.bdh.Text%>&cph=<%this.cph.Text%>&fdjh=<%this.fdjh.Text%>&cjh=<%this.cjh.Text%>'>LinkButton</asp:LinkButton></span></td>
</tr>
<tr>
<td colspan="4" style="height: 216px">
<table style="width: 100%; height: 100%">
<tr>
<td rowspan="3" style="width: 680px">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="SqlDataSource1"
Height="275px" Width="708px">
<FooterStyle BackColor="White" ForeColor="#000066" />
<Columns>
<asp:BoundField DataField="DeptID" HeaderText="DeptID" SortExpression="DeptID" />
<asp:BoundField DataField="InSuranceMan" HeaderText="InSuranceMan" SortExpression="InSuranceMan" />
<asp:BoundField DataField="InSuranceNo" HeaderText="InSuranceNo" SortExpression="InSuranceNo" />
<asp:BoundField DataField="VehicleNo" HeaderText="VehicleNo" SortExpression="VehicleNo" />
<asp:BoundField DataField="EngineNum" HeaderText="EngineNum" SortExpression="EngineNum" />
<asp:BoundField DataField="DriverNo" HeaderText="DriverNo" SortExpression="DriverNo" />
</Columns>
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:cxlpxxConnectionString %>"
SelectCommand="SELECT [DeptID], [InSuranceMan], [InSuranceNo], [VehicleNo], [EngineNum], [DriverNo] FROM [InSurance] WHERE (([InSuranceNo] = @InSuranceNo) OR ([VehicleNo] = @VehicleNo) OR ([EngineNum] = @EngineNum) OR ([DriverNo] = @DriverNo))">
<SelectParameters>
<asp:FormParameter FormField="bdh" Name="InSuranceNo" Type="String" />
<asp:FormParameter FormField="cph" Name="VehicleNo" Type="String" />
<asp:FormParameter FormField="fdjh" Name="EngineNum" Type="String" />
<asp:FormParameter FormField="cjh" Name="DriverNo" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</td>
<td rowspan="3" style="width: 312px">
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
</table>
</td>
</tr>
</table>
</form>
我的提交按钮需要传递4个回本页面,然后让GridView的查询获取这4个参数并显示记录出来.我不知道该怎么写了.最好是后台处理的.不用js的.比如用Button1_Click1
还有,我在Button1里面加了下面的代码能链接,参数好像没获取.不知道问题在那里,请大家帮忙指导下
protected void Button1_Click1(object sender, EventArgs e)
{
this.Button1.PostBackUrl = "index.aspx?bdh=" + this.bdh.Text + "&cph=" + this.cph.Text + "&fdjh=" + this.fdjh.Text + "&cjh=" + this.cjh.Text;
}
然后我点击登录没有反映,地址还是:http://localhost:4876/gztbweb/index.aspx
第三次点击的时候地址变成:http://localhost:4876/gztbweb/index.aspx?bdh=&cph=贵A55833&fdjh=&cjh=
可是数据显示,我不明白怎么回事.2楼说的加载数据是不是protected void Button1_Click1(object sender, EventArgs e)
{
this.Button1.PostBackUrl = "index.aspx?bdh=" + this.bdh.Text + "&cph=" + this.cph.Text + "&fdjh=" + this.fdjh.Text + "&cjh=" + this.cjh.Text;
this.GridView1.DataBind();
}
我添加了代码也没有反映.
this.GridView1.DataBind();
可是没有更改数据,前面的SqlDataSource1的SelectCommand我已经改成了<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:cxlpxxConnectionString %>"
SelectCommand="SELECT DeptID, InSuranceMan, InSuranceNo, VehicleNo, EngineNum, DriverNo FROM InSurance WHERE (VehicleNo = '贵A55833')">
</asp:SqlDataSource>能显示数据,可是我点击按钮以后SelectCommand改变了就不能显示了,我不是不是绑定的问题还是不能这样写.
你需要重新从数据库里取数据,而后再重新绑定呀
在使用 this.GridView1.DataBind() 之前你得指定新的DataSource~
this.GridView1.DataSourceID = "SqlDataSource1";
this.GridView1.DataBind();
运行也不行,能给段代码吗?谢谢了.思路我明白了,可是还是显示不了,我不清楚是那里的问题.