I'm not familiar with using javascript in vb apps - learning. All I know is it does not work
here are relevant peices of the program
Here is the checkbox on the user control
<td align=right>
Check All
<input id="chkAll" type="checkbox" onclick ="CheckAllDataGridCheckBox
document.forms[0].chkAll.c
--------------------------
here is portion of the datagrid on the same user control
<Columns>
<asp:BoundColumn DataField="shortssn" HeaderText="ID"></asp:Boun
<asp:BoundColumn DataField="lastname" HeaderText="Last Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Firstname" HeaderText="First Name"></asp:BoundColumn>
<asp:BoundColumn DataField="lastupdated" HeaderText="Last Updated"></asp:BoundColumn
<asp:BoundColumn DataField="status" HeaderText="Status"></asp:
<asp:TemplateColumn HeaderText="Select">
<ItemTemplate>
<asp:CheckBox id="chkSelect" runat="server"></asp:Check
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
--------------------------
Here is the script on the aspx page that the usercontrol is attached to
<body bgColor="#669900">
<script language =javascript src="formfunctions.js"></s
<form id="Form1" method="post" runat="server">
--------------------------
here is the formfunction.js I added to the visual studio IDE
// JScript File
//checks all DataGrid CheckBoxes with the given name with the given
value
function CheckAllDataGridCheckBoxes
re = new RegExp(':' + aspCheckBoxID + '$') //generated control
name starts with a colon
for(i = 0; i < document.forms[0].elements
elm = document.forms[0].elements
if (elm.type == 'checkbox') {
if (re.test(elm.name)) {
elm.checked = checkVal
}
}
}
}
Hope that helps - all I get for an error is in IE "error on page" on the bottom left corner.
Main Topics
Browse All Topics





by: scoljaPosted on 2006-12-07 at 10:15:57ID: 18095544
I don't see any reason it shouldn't work for a user control. Is the client-side JavaScript code working for you? Does it not save on PostBack? What exactly are the issues you're having with the code?
Thanks.
-- Jason