using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;SqlConnection con = new SqlConnection("Data Source=xxxxxxxxxxx ;Initial Catalog=xxxxxxx;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("select ticketno from order_master where moviename= '" + drpselectmovie.SelectedValue + " 'and moviedate='" + drpselectdate.SelectedValue + "'and show='" + drpselectshow.SelectedValue + "'", con);
DataTable dt9 = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(dt9);
con.Close();
int i = 0;
for (i = 0; i <= dt9.Rows.Count - 1; i++)
{
CheckBox ch = new CheckBox();
ch = Page.FindControl(dt9.Rows[i].ItemArray[0].ToString()); <--- ERROR
ch.Checked = true;
ch.Enabled = false;
ch.BackColor = System.Drawing.Color.Chocolate;
}
i want to check seat avalability of my system, so user can check selecting show time, so user selected show time system check for available seat from database and disbale checkBox that are booked by other users
so my problem is i'm getting Error on "ch = Page.FindControl(dt9.Rows[i].ItemArray[0].ToString());"
What i'm doing wrong here
Error message: cannot implicitly convert type 'system.web.ui.control' to 'system.web.ui.webcontrols.checkbox'
Aucun commentaire:
Enregistrer un commentaire