Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

[Edited] Update Panel Showing odd behavior

$
0
0

Edit: Deleted Previous (too long) question. 
The problem which I was trying to fix caused most of the above problems (I believe), the problem still persists.

protected void RadioButtonList4_SelectedIndexChanged(object sender, EventArgs e) {
        if (RadioButtonList4.SelectedIndex == 0) {
            RadioButtonList1.Items[1].Text = "Resale";
            RadioButtonList1.Items[1].Value = "Resale";
            Label14.Text = "Total Price";
        } else if (RadioButtonList4.SelectedIndex == 1) {
            RadioButtonList1.Items[1].Text = "Old Property";
            RadioButtonList1.Items[1].Value = "Old Property";
            Label14.Text = "Monthly Rent";
        }
    }
<asp:RadioButtonList ID="RadioButtonList4" runat="server" Width="160px" RepeatDirection="Horizontal"
                        RepeatLayout="Flow" AutoPostBack="True" OnSelectedIndexChanged="RadioButtonList4_SelectedIndexChanged"><asp:ListItem Selected="True">Sale</asp:ListItem><asp:ListItem>Rent</asp:ListItem></asp:RadioButtonList>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always"><ContentTemplate><asp:Label ID="Label2" runat="server" Text="Transaction Type" Width="140px"></asp:Label><asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
                                RepeatLayout="Flow"><asp:ListItem Selected="True">New Property</asp:ListItem><asp:ListItem>Resale</asp:ListItem></asp:RadioButtonList><br /></ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="RadioButtonList4" EventName="SelectedIndexChanged" /></Triggers></asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Always"><ContentTemplate><asp:Label ID="Label14" runat="server" Text="Total Price" Width="140px"></asp:Label><asp:TextBox ID="TextBox1" runat="server" Width="160px"></asp:TextBox><br /></ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="RadioButtonList4" EventName="SelectedIndexChanged" /></Triggers></asp:UpdatePanel>

When I click the "Rent" radio button, I see the updation. But when I click the "Sale" radio button instantly, nothing happens. If I, then make changes to any other control with autopostback set to true, the changes that should have occured because of clicking "Sale" radio button appear.

Edit:
It starts working if I change

<asp:ListItem Selected="True">Sale</asp:ListItem><asp:ListItem>Rent</asp:ListItem>

to

<asp:ListItem>Sale</asp:ListItem><asp:ListItem>Rent</asp:ListItem>

but this isn't want I want. I'd like the Sale Radiobutton to be selected by default.

 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>