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!

datareader making form checkbox checked

Status
Not open for further replies.

dzr

Programmer
Nov 20, 2001
109
0
0
US
i thought i had gotten this but it's acting weird. i'm getting a "1" displayed next to the last checkbox in a set of 3.

3 checkboxes - all seperate fields so no multi-select - just on or off..

each one looks like this:

aspx form:
<tr>
<td align="right">
Training
</td>
<td class="inputpad" style="width: 323px">
<asp:CheckBox ID="training" runat="server" />
</td>
</tr>

C# codebehind:
if (dbDataReader["tbl2_training"] == "1") {
training.checked= true;
}

any insight on what i'm missing would be grand!
 
thats strange, try doing a view source on the page, where is the "1" printed???

Known is handfull, Unknown is worldfull
 
vkris: check your html. Can't see how a "1" pops outta this; perhaps its out in an extended line some where; do a search for "1" see if you can find a outlier some where.
 
>>vkris: check your html. Can't see how a "1" pops outta this; perhaps its out in an extended line some where; do a search for "1" see if you can find a outlier some where.

dont understand u dude. i asked him to do a view source to find where the 1 has been outputted by the .NET page. that will give me some idea...

Known is handfull, Unknown is worldfull
 
vbkris - what I meant was that once in a blue moon you'll have a single character which extends to the extreme right on long line with spaces. It has to appear somewhere, so just a thought.
 
the 1 was weird... here's my solution (so simple!) - forgot to add the ToString() on value test.

C# codebehind:
if (dbDataReader["tbl2_training"].ToString() == "1") {
training.checked= true;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top