After a day of hard work, I am exhausted. Paste it here for help. Save your life!
Page: <body>
<Form ID = "form1" runat = "server">
<Div>
<Asp: radiobuttonlist id = "radiobuttonlist1" runat = "server">
</ASP: radiobuttonlist> </div>
<Asp: button id = "button1" runat = "server" onclick = "button#click" text = "button"/>
</Form>
</Body>
</Html>
CS part of solution 1: protected void page_load (Object sender, eventargs E)
{
If (! Ispostback)
{
This. radiobuttonlist1.items. Add (New listitem ("test1", "test1 "));
This. radiobuttonlist1.items. Add (New listitem ("Test2", "Test2 "));
}
}
Protected void button#click (Object sender, eventargs E)
{
Response. Write (this. radiobuttonlist1.selecteditem. value );
}
CS Part II: protected void page_load (Object sender, eventargs E)
{
If (! Ispostback)
{
This. radiobuttonlist1.items. Add (New listitem ("test1", "test1 "));
This. radiobuttonlist1.items. Add (New listitem ("Test2", "Test2 "));
}
}
Protected void button#click (Object sender, eventargs E)
{
Radiobuttonlist RBL = new radiobuttonlist ();
RBL = (radiobuttonlist) page. findcontrol ("radiobuttonlist1 ");
Response. Write (RBL. selecteditem. value );
}
An endless attempt was made to create an instance using the keyword "Please use the new keyword". It was speechless and the experts passed by. Please take the time to help your younger brother. Now the communist society is ready, should it always be communist?