P
Prescott
Ok .. I've been beating my head against the wall for a week now, but no
matter what I do the checkbox is always false. I create a datagrid,
create a template column (all at design time) and add a checkbox
column. The code is below:
******** Form Code ******
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="Check50s.aspx.vb" Inherits="FileUpload.Check50s"%>
<%@ Register TagPrefix="uc1" TagName="Navigation" Src="Navigation.ascx"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Check50s</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<aspataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 88px; POSITION:
absolute; TOP: 240px"
runat="server" Width="848px" Height="120px">
<Columns>
<asp:TemplateColumn HeaderText="Select Corrupt 50's">
<ItemTemplate>
<asp:CheckBox id="Ok" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</aspataGrid>
<asp:Button id="btnSave" style="Z-INDEX: 102; LEFT: 88px; POSITION:
absolute; TOP: 192px" runat="server"
Width="120px" Height="32px" Text="Save 50's"></asp:Button>
<uc1:Navigation id="Navigation1" runat="server"></uc1:Navigation>
</form>
</body>
</HTML>
****** Code behind *******
Private Sub btnSave_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSave.Click
Dim DGI As DataGridItem
Dim TheDir As String = Server.MapPath("SplitFiles")
Dim FileLocation As String
Dim Ssn As String
Dim NoaCode As String
Dim NoaEffDate As String
OraConnection = OpenConnection()
For Each DGI In DataGrid1.Items
Dim CB As Checkbox = _
CType(DataGrid1.Items(0).Cells(0).Controls(1),_
CheckBox)
If Not CB.Checked Then
FileLocation = TheDir & "\" & DGI.Cells(1).Text
Ssn = DGI.Cells(2).Text
NoaCode = DGI.Cells(4).Text
NoaEffDate = DGI.Cells(5).Text
' Store data in database
StoreFile(OraConnection, FileLocation, Ssn _
, NoaCode, NoaEffDate)
File.Delete(FileLocation)
End If
Next
End Sub
What I'm looking for the user to do is mark those rows where the data
is "corrupt" by checking the checkbox and then click the "Save" button.
Problem is, I can't tell which rows the user selects because the
checkbox always returns false. If anyone could help me, it would be
greatly appreciated. Thanks,
Prescott ...
matter what I do the checkbox is always false. I create a datagrid,
create a template column (all at design time) and add a checkbox
column. The code is below:
******** Form Code ******
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="Check50s.aspx.vb" Inherits="FileUpload.Check50s"%>
<%@ Register TagPrefix="uc1" TagName="Navigation" Src="Navigation.ascx"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Check50s</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<aspataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 88px; POSITION:
absolute; TOP: 240px"
runat="server" Width="848px" Height="120px">
<Columns>
<asp:TemplateColumn HeaderText="Select Corrupt 50's">
<ItemTemplate>
<asp:CheckBox id="Ok" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</aspataGrid>
<asp:Button id="btnSave" style="Z-INDEX: 102; LEFT: 88px; POSITION:
absolute; TOP: 192px" runat="server"
Width="120px" Height="32px" Text="Save 50's"></asp:Button>
<uc1:Navigation id="Navigation1" runat="server"></uc1:Navigation>
</form>
</body>
</HTML>
****** Code behind *******
Private Sub btnSave_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSave.Click
Dim DGI As DataGridItem
Dim TheDir As String = Server.MapPath("SplitFiles")
Dim FileLocation As String
Dim Ssn As String
Dim NoaCode As String
Dim NoaEffDate As String
OraConnection = OpenConnection()
For Each DGI In DataGrid1.Items
Dim CB As Checkbox = _
CType(DataGrid1.Items(0).Cells(0).Controls(1),_
CheckBox)
If Not CB.Checked Then
FileLocation = TheDir & "\" & DGI.Cells(1).Text
Ssn = DGI.Cells(2).Text
NoaCode = DGI.Cells(4).Text
NoaEffDate = DGI.Cells(5).Text
' Store data in database
StoreFile(OraConnection, FileLocation, Ssn _
, NoaCode, NoaEffDate)
File.Delete(FileLocation)
End If
Next
End Sub
What I'm looking for the user to do is mark those rows where the data
is "corrupt" by checking the checkbox and then click the "Save" button.
Problem is, I can't tell which rows the user selects because the
checkbox always returns false. If anyone could help me, it would be
greatly appreciated. Thanks,
Prescott ...