if you have 2table , first for orders and second for status, and each order have a status_id, this is the solution:
this should be your markup:
<asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextChanged"></asp:TextBox>
<asp:Repeater ID="rptstatus" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1"
Checked='<%#(int)Eval("status_id")==(int)Session["id"] %>'
Text='<%#Eval("status") %>' runat="server" Enabled="False" />
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:testConnectionString %>"
SelectCommand="SELECT * FROM [status]"></asp:SqlDataSource>
and this is for code behind:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Session["id"] = 0;
}
}
protected void TextChanged(object sender, EventArgs e)
{
int id = Convert.ToInt32(TextBox1.Text);
using (var context = new testEntities())
{
var status_id = (from a in context.orders where a.order_id == id select a).FirstOrDefault();
Session["id"] = status_id.status_id;
}
}
comment if you have a question!