By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,093 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,093 IT Pros & Developers. It's quick & easy.

CheckBox template always evaluate to False even if checked in a DataGrid hosted inside a TabStrip

P: n/a
CheckBox template always evaluate to False even if checked in a DataGrid
hosted inside a TabStrip in ASP.NET

I am trying to develop an ASP.NET application. I am using TabStrip
(which is part of IE WebControls).

Inside a tab I have a datagrid defined as follows:

<iewc:multipage id="MultiPage_Control" style="Z-INDEX: 103; LEFT: 452px;
POSITION: absolute; TOP: 297px" tabIndex="3" runat="server"
Height="160px" Width="458px" BorderColor="#C0C0FF" BorderStyle="Ridge"
<DIV id="Layer6" style="WIDTH: 250px; POSITION: relative; HEIGHT: 80px">
<asp:datagrid id="dgAssignedTo" style="Z-INDEX: 104; LEFT: 13px;
POSITION: absolute; TOP: 17px" runat="server" BorderColor="black"
BorderWidth="1" CellPadding="3" AutoGenerateColumns="False">
<HeaderStyle BackColor="#00AAAA"></HeaderStyle>
<asp:CheckBox id=CheckBox1 runat="server" Checked='<%#
DataBinder.Eval(Container.DataItem, "Active") %>'>
<asp:TemplateColumn HeaderText="Store Address">
<asp:Label ID="lblUsername" Text='<%#
DataBinder.Eval(Container.DataItem, "Username") %>' Runat="server" />
<asp:TemplateColumn HeaderText="Store Address">
<asp:Label ID="lblName" Text='<%#
DataBinder.Eval(Container.DataItem, "Name") %>' Runat="server" />

which is basically a datagrid which has a checkbox (1st column) and 2
other columns
(employee usernames).
What i want is when the user checks a checkbox, I can save that to the

Public Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSave.Click

Dim myDataGridItem As DataGridItem
Dim chkSelected As System.Web.UI.WebControls.CheckBox
Dim strUserName As String
For Each myDataGridItem In dgAssignedTo.Items

chkSelected = myDataGridItem.FindControl("CheckBox1")
' If chkSelected.Checked Then
strUserName =
CType(myDataGridItem.FindControl("lblUsername"), Label).Text
strCriteria = "Update employee Set Active=@strActive " _
& " Where Username=@strUsername"

cmdSelect4 = New SqlCommand(strCriteria, conHelpdesk)
cmdSelect4.Parameters.Add("@strUsername", strUserName)
cmdSelect4.Parameters.Add("@strActive", SqlDbType.Bit).Value
= chkSelected.Checked

' End If


End Sub

However even if the user checks the checkbox next to the employee column
always evaluates to false.

This same code when the datagrid is outside of the TabStrip executes
fine but inside the
TabStrip always evaluates to false.

I have checked MSDN KB but cannt find any errors.

Pls Help,

*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.