Click here to Skip to main content
15,905,612 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In the following method I declared double value=0. But it arises an error. I have mentioned the error : "A get or set accessor expected"
I can't understand why such an error arises. Please help me.
C#
private System.Boolean CheckvalidationForRadioButton
{
    //CheckValidation
    double value = 0;
    for (int i = 0; i < grdEditSparePartsMaintenance.Rows.Count; i++)
    {
        RadioButton rd = (RadioButton)grdEditSparePartsMaintenance.Rows[i].Cells[0].FindControl("chkEdit");
        if (rd != null)
        {
            if (rd.Checked)
            {
                value += 1;
            }
        }
    }
    if (value > 1)
    {
        Alert("Select Any one checkbox");
    }
}
Posted
Updated 22-May-13 20:14pm
v7
Comments
[no name] 22-May-13 7:10am    
"double value = 0;" try using a variable name other than "value"
lukeer 23-May-13 2:17am    
When posting code, please enclose it in "pre tags". That's what they look like:
<pre lang="c#">YourCodeHere();</pre>
It makes code much easier to read. And the editor should help you with that when pasting code in it.

your missing parentheses () at method it should be like

C#
private System.Boolean CheckvalidationForRadioButton()
{
...
}
 
Share this answer
 
v3
Comments
lukeer 22-May-13 8:14am    
+5. I totally missed that one.
CHill60 22-May-13 8:29am    
Nice spot! +5
Sumon562 23-May-13 0:59am    
Thank you
you are missing parentheses() at method,so .Net compiler trying to compile as property which required get and set accessor .
 
Share this answer
 
Comments
Sumon562 23-May-13 0:44am    
Thank you Mr. siddharthrainit

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900