public partial class Subjectlist : System.Web.UI.Page
{
string strsubid;
DAl obj = new DAl();
DataTable dt = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
if (!(IsPostBack))
{
string strsub = "select uniqid,subjectname from subjectmaster7 order by subjectname";
dt = obj.getdata(strsub);
for (int i = 0; i <= dt.Rows.Count - 1; i++)
{
rdobtnlist.Items.Add(dt.Rows[i]["subjectname"].ToString());
}
}
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
obj.sqlstr = "select distinct s.uniqid,subjectname from subjectmaster7 s inner join questionmaster7 q on q.f_subjectmaster7 = s.uniqid where subjectname='" + rdobtnlist.SelectedItem.Text + "'";
dt = obj.getdata(obj.sqlstr);
if (dt.Rows.Count > 0)
{
strsubid = dt.Rows[0]["uniqid"].ToString();
Session.Add("subjectid", strsubid);
Response.Redirect("QuestionMaster.aspx");
}
else
{
Label2 .Text = "Question not Found";
}
}
protected void rdobtnlist_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
No comments:
Post a Comment