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  
Iron Speed Designer is a software development tool for building database, reporting, and forms applications for .NET without hand-coding.
 


  Sponsors  

Meet Our Sponsors

DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
Jango Studios - Skins, Modules and Hosting for DotNetNuke
eUKhost.com is commited to offer exceptional UK Windows Web Hosting solutions with quality 24x7 technical support.Our plans support ASP.Net, ASP, ASP.NET Ajax extensions, XML, MSSQL, MySQL, PHP,DNN, multiple domains and Shared SSL as standard.
SmarterTools
The Official Microsoft ASP.NET Website
 


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.

 


$7.16/mo - Powerful DotNetNuke / DNN Hosting
Powerful DotNetNuke / DNN Hosting on Windows 2008 and 2003 servers, starting at under $8/mo with FREE SQL 2008 on certain plans and FREE SQL 2005 on all plans with FREE Installation and expert support.
www.re-invent.com
ASP.NET Web Hosting for $3.95
3 Month FREE ASP.NET Hosting! FREE Setup! DNN Support! FREE Domain Name! FREE Components! Host multiple websites on 1 plan! 30 Days Money Back Guarantee!
www.dailyrazor.com
Cestus Websites
DotNetNuke websites en services in Nederland. Cestus Websites levert websites, projectmanagent, skins, modules, training en gespecialiseerde hosting op basis van het CMS DotNetNuke.
www.dotnetnuke-websites.nl

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