| |

VerySource

 Forgot password?
 Register
Search
View: 7284|Reply: 33

I have been engaged in .net development for a year and a half, and encountered a very difficult problem (how to cancel t

[Copy link]

1

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-2-15 20:30:01
| Show all posts |Read mode
I have a radiobuttonlist
<asp: RadioButtonList ID = "rblist" Runat = "server" RepeatDirection = "Horizontal">
<asp: ListItem Value = "1"> Translator </ asp: ListItem>
<asp: ListItem Value = "2"> Done </ asp: ListItem>
</ asp: RadioButtonList>

My question is: once an item is selected, and then click to cancel it (making both items unselected), can I do it with JAVASCRIPT? Hope to enlighten me. . . . . .
Reply

Use magic Report

0

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 Unknown

Post time: 2020-4-18 20:30:01
| Show all posts
I don't use radiobuttonlist very much, but I think javascript can be achieved

var obj = document.getElementById ("rblist");
obj.option [0] .checked = false;

Didn't try, probably this is it
Reply

Use magic Report

0

Threads

38

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-4-18 23:00:02
| Show all posts
I think it's impossible ~
Reply

Use magic Report

0

Threads

29

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 China

Post time: 2020-4-19 13:45:01
| Show all posts
If it is a static page
===============================================
Reply to:ppaannyyjj() Reputation: 100 2017-01-04 21:19:43 Score: 0
I don't use radiobuttonlist very much, but I think javascript can be achieved

var obj = document.getElementById ("rblist");
obj.option [0] .checked = false;

Didn't try, probably this is it
==================================================
If it is an aspx page, the server control should have the value of ViewState. JavaScript can change the value of the html control, but the value of the view cannot be changed. JavaScript seems to have been canceled, but it is actually an illusion.
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-4-19 19:30:02
| Show all posts
ID_Button.Attributes ["onclick"] = "javascript: var delflag; var a = document.getElementsByName (\" ID_Class\"); if (a [1] .checked) {alert ('Selected other charged items');} if (a [0] .checked) {alert ('Selected basic charge item');} return false; ";
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-4-19 23:45:01
| Show all posts
<asp: RadioButtonList ID = "RadioButtonList1" runat = "server">
            <asp: ListItem onclick = "set (this);"> a </ asp: ListItem>
            <asp: ListItem onclick = "set (this);"> b </ asp: ListItem>
        </ asp: RadioButtonList> </ div>

    <script>
        var id = "";
        function set (c)
        {
            
            if (c.id == id)
            {
                c.checked = false;
                id = "";
            }
            else
                id = c.id;
        }
    </ script>
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-20 21:00:01
| Show all posts
cqgang
 
 
   I think it's impossible ~
  
 
________________________________________________________
what do you mean?
Reply

Use magic Report

1

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-4-28 09:15:01
| Show all posts
papaibobomethod, I tried it, it seems not work. . .
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-28 10:00:02
| Show all posts
I also want to know if it works, up!
Reply

Use magic Report

0

Threads

29

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 China

Post time: 2020-4-28 20:45:01
| Show all posts
I tried to cancel it, but it did n’t make much sense
<form id = "Form1" method = "post" runat = "server">
<asp: RadioButtonList id = "radioBtnList" style = "Z-INDEX: 101; LEFT: 232px; POSITION: absolute; TOP: 136px"
runat = "server">
<asp: ListItem Value = "111"> 111 </ asp: ListItem>
<asp: ListItem Value = "2222"> 2222 </ asp: ListItem>
<asp: ListItem Value = "3333"> 3333 </ asp: ListItem>
</ asp: RadioButtonList>
<asp: Button id = "btnCancel" style = "Z-INDEX: 102; LEFT: 408px; POSITION: absolute; TOP: 168px"
runat = "server" Text = "Cancel"> </ asp: Button>
</ form>
private void btnCancel_Click (object sender, System.EventArgs e)
{
bool bFlag = false;
this.radioBtnList.SelectedItem.Selected = bFlag;
}
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list