Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkbox Control

Status
Not open for further replies.

vikaskalra

Technical User
Aug 12, 2002
41
0
0
GB
Hi !!

I have a Checkbox control, which I have placed inside a repeater control. I have to conditionally show it checked / unchecked.

It works fine when I select the first set of Values from a dropdown list box.

Now when I change the selection in the Dropdown and re-load the page, although from Code Behind, is setting the Checked property to True / False as the case may be, but when the page is done, it is showing only the previous selection.

FYI

<asp:CheckBox EnableViewState=False ID=&quot;ChkView2&quot; Runat=&quot;server&quot; Checked='<%# SetCheckUncheck(Container.DataItem(0),&quot;View&quot;)%>'></asp:CheckBox>

The call to SetCheckUncheck returns True / False as the case may be.

Any help will be greatly appreciated.

Regards,
Vikas
 
If I understand your question correctly, make sure that your binding occurs in an if(!Page.IsPostBack) handler. This will make sure that the data is bound only the first time.

-----------------------------------------------
&quot;The night sky over the planet Krikkit is the least interesting sight in the entire universe.&quot;
-Hitch Hiker's Guide To The Galaxy
 
Hi !

Thanks for your response. Actually I populate the Checkboxes from the DB too. There is a Table, corresponding to the Records in that Table I get the rows.

The Dropdown contains a set of values. When you select a particular value, depending on that value I fetch the rows and show some checked while others unchecked.

I hope the condition is now clear to you, if not, please let me know I will give more clarification on it.

Thanks for your response.
Regards,
Vikas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top