使用masterpagefile时,Selectedindexchanged无法正常工作 [英] Selectedindexchanged not working correctly when masterpagefile is used

查看:91
本文介绍了使用masterpagefile时,Selectedindexchanged无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助。

使用MasterPageFile时,我的代码块无法正常工作。





它没有MasterPageFile。

如果下拉列表发生变化,则会显示gridview数据。

但是使用MasterPageFile,没有数据显示。

It似乎在下拉列表更改时回发,但无法识别SelectParameters(@KO_EGScore)。



这是我的代码

Please help.
I have a block of codes not working correctly when MasterPageFile is used.


It works without MasterPageFile.
If dropdownlist changes, the gridview data displays.
But with a MasterPageFile, no data display.
It seems posted back when dropdownlist changes, but the SelectParameters (@KO_EGScore) cannot be recognized.

Here is my code

<form id="form1" runat="server">
    <div>
    <h4>List KO Number Genes Data <asp:Label ID="Label1" runat="server" Text="" CssClass="indent small navy"></asp:Label></h4>
     <p>
         <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="KO_EGScore" DataValueField="KO_EGScore" AppendDataBoundItems="true">
             <asp:ListItem Value="">(Please select)</asp:ListItem>
         </asp:DropDownList>
         <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ws_ePathConnectionString %>" SelectCommand="SELECT DISTINCT top(10)  [KO_EGScore] FROM [b_KO_2_EGScore] ORDER BY [KO_EGScore]"></asp:SqlDataSource>
     </p>
     <p>
         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" CellPadding="4"  DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None">
            
         </asp:GridView>
         <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ws_ePathConnectionString %>" SelectCommand="SELECT  top(10) * FROM [b_ko_orgGenes] WHERE ([koNbr] = @KO_EGScore)">
             <SelectParameters>
                 <asp:FormParameter FormField="DropDownList1" Name="KO_EGScore" Type="String" />
             </SelectParameters>
         </asp:SqlDataSource>
     </p>
     
    </div>
    </form>





我尝试了什么:



我试过了

ClientIDMode =静态,

ScriptManager,和

AutoEventWireup =true ,

他们都没有工作。



What I have tried:

I tried the
ClientIDMode="Static",
ScriptManager, and
AutoEventWireup="true" ,
none of them worked.

推荐答案

ConnectionStrings:ws_ePathConnectionString%>SelectCommand =SELECT DISTINCT top(10)[KO_EGScore ] FROM [b_KO_2_EGScore] ORDER BY [KO_EGScore]>< / asp:SqlDataSource>
< / p>
< p>
< asp:GridView ID =GridView1 runat =serverAutoGenerateColumns =trueCellPadding =4DataSourceID =SqlDataSource2ForeColor =#333333GridLines =None>

< / asp:GridView>
< asp:SqlDataSource ID =SqlDataSource2runat =serverConnectionString =<%
ConnectionStrings:ws_ePathConnectionString %>" SelectCommand="SELECT DISTINCT top(10) [KO_EGScore] FROM [b_KO_2_EGScore] ORDER BY [KO_EGScore]"></asp:SqlDataSource> </p> <p> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" CellPadding="4" DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None"> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%


ConnectionStrings:ws_ePathConnectionString%>SelectCommand =SELECT top(10) * FROM [b_ko_orgGenes] WHERE([koNbr] = @KO_EG分)>
< SelectParameters>
< asp:FormParameter FormField =DropDownList1Name =KO_EGScoreType =String/>
< / SelectParameters>
< / asp:SqlDataSource>
< / p>

< / div>
< / form>
ConnectionStrings:ws_ePathConnectionString %>" SelectCommand="SELECT top(10) * FROM [b_ko_orgGenes] WHERE ([koNbr] = @KO_EGScore)"> <SelectParameters> <asp:FormParameter FormField="DropDownList1" Name="KO_EGScore" Type="String" /> </SelectParameters> </asp:SqlDataSource> </p> </div> </form>





我尝试了什么:



我试过了

ClientIDMode =静态,

ScriptManager,和

AutoEventWireup =true ,

他们都没有工作。



What I have tried:

I tried the
ClientIDMode="Static",
ScriptManager, and
AutoEventWireup="true" ,
none of them worked.


使用 ControlParameter [ ^ ]而不是:

Use a ControlParameter[^] instead:
<asp:ControlParameter Name="KO_EGScore" Type="String" ControlID="DropDownList1" PropertyName="SelectedValue" />



FormParameter 正在查找具有指定名称的已发布值。将控件放在命名容器中将更改用于将值发布回服务器的名称。更改 ClientIDMode 不会对名称产生任何影响。


The FormParameter is looking for a posted value with the specified name. Putting the control in a naming container will change the name that's used to post the value back to the server. Changing the ClientIDMode won't have any effect on the name.


这篇关于使用masterpagefile时,Selectedindexchanged无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆