Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

PortalWebHosting
  Ads  
Webhost4Life - $4.95 Windows Hosting
 


  Sponsors  

Meet Our Sponsors

SmarterTools
The Official Microsoft ASP.NET Website
Portal Webhosting - Hosting For Developers
Red-Gate Software
MaximumASP
SourceGear - Tools for Developers
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Configure It! (...  HELP!!! Checkbox in datagrid always return "False"
Previous Previous
 
Next Next
New Post 4/4/2008 6:41 AM
User is offline Jos Richters
61 posts
www.visualdata.nl
10th Ranked


HELP!!! Checkbox in datagrid always return "False" 

Hello,

I have a datagrid based on a set of files in a directory, and I want the possibility to delete one or more of them by checking a checbox I added in the datagrid.

I can check the box, but, in no way whatsoever, I get a "True" status in by code behind.

I'm coding for DNN 04.08.02 in Microsoft Visual Studio 2005 (Professional edition)

A snippet  below:

HTML-part:

<

asp:datagrid id="MP3FileList" runat="server" Width="100%" Font-Name="Verdana" AutoGenerateColumns="False"

 

AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="Navy" HeaderStyle-ForeColor="White"

 

HeaderStyle-Font-Size="15pt" HeaderStyle-Font-Bold="True">

 

<columns>

 

<asp:TemplateColumn HeaderText="MP3 File" Visible="True">

 

<ItemTemplate>

 

<asp:Label ID="lblName"

 

Text='<%# DataBinder.Eval(Container.DataItem,"Name") %>'

 

Runat="server" />

 

</ItemTemplate>

 

</asp:TemplateColumn>

 

<asp:BoundColumn DataField="LastWriteTime" HeaderText="Last Write Time" ItemStyle-HorizontalAlign="Center" DataformatString="{0:d}" />

 

<asp:BoundColumn DataField="Length" HeaderText="File Size" ItemStyle-HorizontalAlign="Right" DataformatString="{0:#,### bytes}" />

 

<asp:TemplateColumn HeaderText="Delete" ItemStyle-HorizontalAlign="Center">

 

<ItemTemplate>

 

<asp:CheckBox id="chkSelect" Enabled="True" Runat="server"></asp:CheckBox>

 

</ItemTemplate>

 

</asp:TemplateColumn>

 

</

</columns>asp:datagrid>

Code behind part:

 

cb =

 

For Each dgi In MP3FileList.ItemsCType(dgi.Cells(0).FindControl("chkSelect"), CheckBox)If cb.Checked Then

strCheckedInt =

"True"

 

Else

strCheckedInt =

"False"

 

End If

 

'================ Start TraceLog ================

strItem =

"cmdDelete dgiCell(3)Cont(Find)"

strDetail =

strResult =

TraceLog(strModule, strItem, strDetail, strResult)

 

"Record#: " & MP3FileList.Items.ToString"to delete: " & strCheckedInt'================= End TraceLog =================

 

'OK tot hier...

strFieldName =

cb.Checked =

 

CType(dgi.FindControl("lblName"), Label).TextCType(dgi.FindControl("chkSelect"), CheckBox).CheckedIf cb.Checked Then

strCheckedInt =

"True"

 

Else

strCheckedInt =

"False"

 

End If

 

'================ Start TraceLog ================

strItem =

"cmdDelete Index"

strDetail =

strResult =

TraceLog(strModule, strItem, strDetail, strResult)

 

"Field: " & strFieldName"to delete: " & strCheckedInt'================= End TraceLog =================

 

Next

(Below is the tracelog part that I use for bdebugging purposes......)

 

 

Public Sub TraceLog(ByVal strModule As String, ByVal strItem As String, ByVal strDetail As String, ByVal strResult As String)If boolDoTraceLog Then

 

intLogRecord = intLogRecord + 1

 

Dim strDateTime As DateTime = Now()If Not IO.File.Exists(strTraceLog) Then

 

writer.WriteLine(

writer.Close()

 

Dim writer As IO.StreamWriter = IO.File.CreateText(strTraceLog)"Log#: " & intLogRecord & " Created: " & strDateTime & "; Module: " & strModule & "; Item: " & strItem & "; Detail: " & strDetail & "; Result: " & strResult)Else

 

writer.WriteLine(

writer.Close()

 

Dim writer As IO.StreamWriter = IO.File.AppendText(strTraceLog)"Log#: " & intLogRecord & " Append: " & strDateTime & "; Module: " & strModule & "; Item: " & strItem & "; Detail: " & strDetail & "; Result: " & strResult)End If

 

End If

 

End Sub


jos Richters www.visualdata.nl
 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Configure It! (...  HELP!!! Checkbox in datagrid always return "False"
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Alki Homes - Seattle, WA
Exemplary service for your Seattle Real Estate needs. It's what you deserve from your Realtor®!
www.alkihomes.com
PointClick DotNetNuke Solutions
PointClick Technologies provides high-end DNN Hosting for businesses.
PointClick.Net Hosted Solutions
Active Modules, Inc.
Creators of Active Forums, the best forum module for DotNetNuke
www.activemodules.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP