ovo je jednostavna forma sa 3 RadioButtonList koja predstavljaju ponudjene odgovore.
E sad trebam sabrati bodove od tacnih odgovora i prikazati ih u labeli4.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int p=0;
{
if (RadioButtonList1.SelectedIndex == 0) p = p + 10;
else if (RadioButtonList1.SelectedIndex == 1) p = p -5;
else if (RadioButtonList1.SelectedIndex == 2) p = p;
if (RadioButtonList2.SelectedIndex == 0) p = p + 10;
else if (RadioButtonList2.SelectedIndex == 1) p = p - 5;
if (RadioButtonList3.SelectedIndex == 0) p = p + 10;
else if (RadioButtonList3.SelectedIndex == 1) p = p - 5;
}
if (p == 10) Label4.Text= p;
itd..
problem je u ovom: if (p == 10) Label4.Text= p; (ne moze ni if (p == 10) Label4.Text= p.ToString)
kako to da resim?