如何在ajax asp.net中使用updatepanel进行radiobuttonlist [英] how to use updatepanel for radiobuttonlist in ajax asp.net

查看:56
本文介绍了如何在ajax asp.net中使用updatepanel进行radiobuttonlist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了以下代码:

 <   asp:UpdatePanel     ID   =  UpdatePanel2    runat   = 服务器 >  
< span class =code-keyword>< ContentTemplate >
< asp:RadioButtonList ID = RadioButtonList1 runat = server

AppendDataBoundItems < span class =code-keyword> = True AutoPostBack = True BackColor = 白色

ForeColor = #009999

onselectedindexchanged = RadioButtonList1_SelectedIndexChanged

RepeatDirection = 水平 RepeatLayout < span class =code-keyword> =
Flow
< span class =code-attribute>
style = text-align:left;上:407px;左:98px;位置:绝对;宽度:143px;身高:23px; border-style:无 >
< asp:ListItem > 所有者< / asp:ListItem >
< asp:ListItem > 经纪人< / asp:ListItem >
< / asp:RadioButtonList >
< / ContentTemplate >
< / asp:UpdatePanel >





整个页面都刷新了。任何人都可以帮助理清。上述代码没有发生部分页面呈现。

解决方案

您可以将其用于整个页面内容,而不是使用updatepanel到radiobuttonlist。



我希望它可以帮助您解决问题



- SRJ


 <%@       语言  =  C#   %>  

< !DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // EN

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd >

< script runat = 服务器 >

protected void Button1_Click( object sender ,EventArgs e)
{
Label1.Text = 刷新于 +
DateTime.Now.ToString();
}
< / script >

< html xmlns = http://www.w3.org/1999/xhtml >
< head runat = server >
< title > UpdatePanel教程< / title >
< style type = text / css >
UpdatePanel1 {
width 300px;
}
< / style >
< / head >
< body >
< for m id = form1 runat = server >
< div >
< asp:ScriptManager ID = ScriptManager1 runat = server >
< / asp:ScriptManager >
< asp:UpdatePanel ID = UpdatePanel1 runat = server >
< ContentTemplate >
< fieldset >
< 图例 > 的UpdatePanel < span class =code-keyword>< / legend >
< asp:标签 ID = Label1 runat = 服务器 文本 = 创建的面板。 > < / asp:标签 > < br / >
< / fieldset >
< / ContentTemplate >
< 触发器 >
< < span class =code-leadattribute> asp:AsyncPostBackTrigger ControlID = Button1 / >
< /触发器 >
< / asp:UpdatePanel >
< asp:按钮 ID = Button1 runat = server OnClick = Button1_Click 文本 = 按钮 < span class =code-attribute> / > < / div >
< / form >
< / body >
< / html >


I used following code:

<asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
        <asp:RadioButtonList ID="RadioButtonList1" runat="server"

            AppendDataBoundItems="True" AutoPostBack="True" BackColor="White"

            ForeColor="#009999"

            onselectedindexchanged="RadioButtonList1_SelectedIndexChanged"

            RepeatDirection="Horizontal" RepeatLayout="Flow"

            style="text-align: left; top: 407px; left: 98px; position: absolute; width: 143px; height: 23px; border-style: None">
            <asp:ListItem>Owner</asp:ListItem>
            <asp:ListItem>Broker</asp:ListItem>
        </asp:RadioButtonList>
        </ContentTemplate>
        </asp:UpdatePanel>



The whole page is refreshed. Can anyone help to sort out. Partial page rendering is not happening for the above code.

解决方案

Instead of using updatepanel to the radiobuttonlist, you might use it to the entire page content

I hope it will help you to resolve your problem

--SRJ


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = "Refreshed at " +
            DateTime.Now.ToString();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>UpdatePanel Tutorial</title>
    <style type="text/css">
    #UpdatePanel1 {
      width:300px;
     }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <fieldset>
                <legend>UpdatePanel</legend>
                <asp:Label ID="Label1" runat="server" Text="Panel created."></asp:Label><br />
                </fieldset>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Button1" />
            </Triggers>
        </asp:UpdatePanel>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
    </form>
</body>
</html>


这篇关于如何在ajax asp.net中使用updatepanel进行radiobuttonlist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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