Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi experts
i have a gridview that in every row of it i create several html radio button dynamically,how i can access to dynamic html radio button that i created them dinamically in click_button,when user clicked on submit click how i can understand wiche one them is checked?

C#
protected void grdData_RowDataBound(object sender, GridViewRowEventArgs e)
    {

            var drvData = (DAL.CompetitionQuestion)e.Row.DataItem;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var strLiteral = Template;
                var strOption = "";
                strLiteral = strLiteral.Replace("[Question]", drvData.QuestionBody);

                var query = BLL.Competitions.GetOptionByQuestionID(drvData.QuestionID);
                foreach (var item in query)
                {
                    strOption = strOption + string.Format("<input type=\"radio\" name=\"{0}\" value=\"{1}\"> {1}<br/>",item.QuestionID,item.OptionBody);
                }

                strLiteral = strLiteral.Replace("[Option]",strOption);
                e.Row.Cells[0].Text = strLiteral;
            }

    }


and its my sumit click

C#
protected void btnVote_Click(object sender, EventArgs e)
    {
what i must write here for access to html radio button
}

thanks in advance
Posted

1 solution

what i must write here for access to html radio button
You cannot write anything here to access them. You made a HTML control and not server control. HTML controls cannot be accessed on server side codebase.
 
Share this answer
 
Comments
zinajoonjooni 20-Jul-12 23:33pm    
do you have any idea for solve my problem?what i can do?what i can use instead of html control?if i use html control with runat=server ,is it possible?
Sandeep Mewara 21-Jul-12 12:25pm    
Yes. Possible.

Apart from adding runat=server, you also need to add the oncheckchange event for the radio button.

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