Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Hoe to get DataList Checkbox status in item template

Reply
Thread Tools

Hoe to get DataList Checkbox status in item template

 
 
Vannela
Guest
Posts: n/a
 
      12-16-2003
I want to get the status of the checkbox control in the
item template of the DataList in the code behind

Using findcontrol i am not able to get the status of the
checkbox . How shouls i get the status of the checkbox
whether it is checked or not?\

Thank you
 
Reply With Quote
 
 
 
 
Eugene Jenihov
Guest
Posts: n/a
 
      12-16-2003
Hi...

foreach(DataListItem item in MyDataList.Items) {
CheckBox myCheckBox = (CheckBox)item.FindControl("chkMyCheckBox");
if (myCheckBox.Checked)
{
//do some work
}
}

"Vannela" <(E-Mail Removed)> wrote in message
news:00b901c3c395$cb22ba20$(E-Mail Removed)...
> I want to get the status of the checkbox control in the
> item template of the DataList in the code behind
>
> Using findcontrol i am not able to get the status of the
> checkbox . How shouls i get the status of the checkbox
> whether it is checked or not?\
>
> Thank you



 
Reply With Quote
 
 
 
 
Paul X
Guest
Posts: n/a
 
      12-17-2003

How do i do this in VB?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Eugene Jenihov
Guest
Posts: n/a
 
      12-18-2003
Domething like this...

Dim item As DataListItem
Dim myCheckBox As CheckBox
For Each item In DataList1.Items
If (CType(item.FindControl("chkMyCheckBox"),
CheckBox).Checked)
'Do some work
End If
Next item


"Paul X" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> How do i do this in VB?
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
Vannela
Guest
Posts: n/a
 
      12-29-2003
Hi

I am getting the error as null object reference
I am no able to get the checkbox of the datalist into the
my checkbox ie., myCheckBox

What could be the problem?


Thank you


>-----Original Message-----
>Hi...
>
>foreach(DataListItem item in MyDataList.Items) {
> CheckBox myCheckBox = (CheckBox)item.FindControl

("chkMyCheckBox");
> if (myCheckBox.Checked)
> {
> //do some work
> }
>}
>
>"Vannela" <(E-Mail Removed)> wrote in

message
>news:00b901c3c395$cb22ba20$(E-Mail Removed)...
>> I want to get the status of the checkbox control in the
>> item template of the DataList in the code behind
>>
>> Using findcontrol i am not able to get the status of the
>> checkbox . How shouls i get the status of the checkbox
>> whether it is checked or not?\
>>
>> Thank you

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why gem built with hoe depends on hoe? pluskid Ruby 8 02-05-2008 08:28 PM
CheckBox Outside DataList & Labels Inside DataList rn5a@rediffmail.com ASP .Net 1 12-24-2006 02:28 PM
Help: Checkbox in datalist - checked status = ALWAYS FALSE! VB Programmer ASP .Net 1 04-13-2005 12:59 AM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
DataList checkbox status Vannela ASP .Net 1 12-17-2003 10:35 AM



Advertisments