我有一个dropdownlist控件
传递值给gridview 点击gridview上的linkbuttom传递值到另外一个gridview
原网页地址?id={0} 这样的形式
现在的问题是一点击linkbuttom 页面刷新了 dropdownlist的值就变成第一项的值有什么办法让这个控件只能通过点击它更改他的属性吗?有人说用updatepanel实现局部刷新 ajax
对这个不了解 能帮我看看么 最好有实例
传递值给gridview 点击gridview上的linkbuttom传递值到另外一个gridview
原网页地址?id={0} 这样的形式
现在的问题是一点击linkbuttom 页面刷新了 dropdownlist的值就变成第一项的值有什么办法让这个控件只能通过点击它更改他的属性吗?有人说用updatepanel实现局部刷新 ajax
对这个不了解 能帮我看看么 最好有实例
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
GridLines="None" DataKeyNames="ID" HorizontalAlign="Center"
OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<asp:LinkButton ID="lbtnCheck" runat="server" CommandArgument='<%#Eval("ID")%>'
CommandName="Check">查看</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Check")
{
Response.Redirect("b.aspx?ID=" + e.CommandArgument.ToString());
}
}
恩,不让页面postback就可以了
还有<a href="javascript:void(0)" onclick="window.location='xxx.aspx?id={<%#Eval("id")%>}';return false;" /> 也一样
页面一刷新 下拉框的值还是变成第一项
你这种情况我以前出现过,只需将下拉列表的绑定方法放到!ispostback中就行了