-5

Server Error in '/asppub' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: 'ASP.mis3200_unit4_ringu4pos_aspx' does not contain a definition for 'rblSnacks_SelectedIndexChanged' and no extension method 'rblSnacks_SelectedIndexChanged' accepting a first argument of type 'ASP.mis3200_unit4_ringu4pos_aspx' could be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 102:                    Would you like any snacks?</td>
Line 103:                <td class="style7">
Line 104:                    <asp:RadioButtonList ID="rblSnacks" runat="server"  
Line 105:                        RepeatDirection="Horizontal" Width="96px" AutoPostBack="True" 
Line 106:                        onselectedindexchanged="rblSnacks_SelectedIndexChanged">

Source File: c:\Users\Ryan\Desktop\asppub\MIS3200\Unit4\RingU4POS.aspx Line: 104

The given error message in my coding class was this:

 Snacks: toggle visiblity based on yes/no selection:  -2

The list of snacks should only be visible when somebody selects Yes (otherwise, it should be invisible). You needed to double-click the RadioButtonList to create a method which had functionality to toggle the visibility property of the CheckBoxList. For this method to work, you must enable AutoPostBack for the RadioButtonList. "

What am I doing wrong? Any help would be appreciated.

Raging Bull
  • 18,593
  • 13
  • 50
  • 55
Ryan Ring
  • 31
  • 4

4 Answers4

1

You have missed this in server side

protected void rblSnacks_SelectedIndexChanged(object sender, EventArgs e)
{

}
Kevin Brechbühl
  • 4,717
  • 3
  • 24
  • 47
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
1

You should define a rblSnacks_SelectedIndexChanged method in a code behind that will handle the SelectedIndexChange event for the radio button. And if you do not need it, you should remove it.

Verkion
  • 630
  • 8
  • 25
PetarPenev
  • 339
  • 3
  • 7
1

Add this code in your code behind

protected void rblSnacks_SelectedIndexChanged(object sender, EventArgs e)
{
    // some code
}
Kevin Brechbühl
  • 4,717
  • 3
  • 24
  • 47
Nagaraj S
  • 13,316
  • 6
  • 32
  • 53
0

As the error suggests, you have to have the SelectedIndexChanged in your code behind. So add this code,

protected void rblSnacks_SelectedIndexChanged(object sender, EventArgs e)
{
    //your code;
}
shanish
  • 1,964
  • 12
  • 35
  • 62