473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

if i check one checkbox so many check boxes should get checked

i have a web based website in which i have some 14 tabs(i took labels)
i placed all 14 tabs controls in 14 different views of a multiview and in the

click event of each label i am writing


protected void lbASurgery_Click(object sender, EventArgs e)
{
multiView.ActiveViewIndex = 0;
}

multiView.ActiveViewIndex = 0;

multiView.ActiveViewIndex = 1;


multiView.ActiveViewIndex = 2;

and so on depending upon the respective label get selected the respective form is getting visible.

in short if i check a check box in one view ,checkbox in other view of the same multiview must get Checked .


[so my necessity is that if i check one checkbox in one form( ie., which is getting visible using one label ) another checkbox in other form needs to be
gets checked automatically.]




i have to use javascript function.

i already wrote javascript function but its working to elements pertaining to one view (form) only.

pls sugesst me in this regard , if possible using a sample code


with regards and thanks

vijay
Jun 4 '07 #1
3 2210
acoder
16,027 Expert Mod 8TB
Get the form objects and loop through the elements array checking for the type and check all the checkboxes. If you get stuck, give an example of a form.
Jun 4 '07 #2
Explanationi am sending a sample code plese see it in VS-2005 FOR BETTER UNFERSTANDING

I have a main page called DEFAULT.ASPX
it has a drop down list and 3 contentplace holders


dropdown list With 3 parameters A,B,C if i select any options in drop down list the respective Content place holder will add respective user control and get Visible.

for example A is selected in drop down ------- content place holder A is selected and it will add A.ascx file and get visible


IN the USer control file it has link buttons and a MULTIVIEW, the multiview in turn has some views and each view has checkboxes.



THE PROBLEM

here When i check checkbox A1 from view1 then checkbox A2 in view 2 should automatically checked. (client side and i have use javascript)



example

default.aspx script code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Src="~/A.ascx" TagName="ucFernandez" TagPrefix="uc1" %>
<%@ Register Src="~/C.ascx" TagName="wucAdmin" TagPrefix="uc3" %>
<%@ Register Src="~/B.ascx" TagName="wucClient" TagPrefix="uc2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Case Sheet</title>
</head>
<body topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0>
<form id="form1" runat="server">
<div>
<table width="100%">
<tr>
<td colspan="5" align="center" style="height: 85px" >
<!--Hospital Table -->
<fieldset style="background-color: #e1f3ff">
<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#e1f3ff">
<tr>
<td colspan="6">
</td>
</tr>
<tr>
<!--Select Hospital-->
<td valign="middle" width="16%" align="left">
<asp:Label ID="lblselectone" runat="server" Font-Size="11pt" Text='select one place holder' Width="188px"
Height="12px" ForeColor="Black" Font-Names="Verdana"></asp:Label>
</td>
<td align="Left" width="16%">
<asp:DropDownList ID="ddlSelectone" runat="server" Font-Size="10pt" Width="120px" AutoPostBack="True" >
<asp:ListItem>A</asp:ListItem>
<asp:ListItem>B</asp:ListItem>
<asp:ListItem>C</asp:ListItem>
</asp:DropDownList></td>
<!--Case.No(Total)-->
<td align="left" colspan="4">
&nbsp; &nbsp;&nbsp;</td>
<!--Case.No(Hospital)-->
</tr>
</table>
</fieldset>
<!-- End of Hospital Details-->
</td>
</tr>
<tr>
<td width=100% valign=top style="height: 16px">
<asp:PlaceHolder ID="PleacepholderA" runat="server" Visible="False"></asp:PlaceHolder>
<asp:PlaceHolder ID="PlaceHolderB" runat="server" Visible="False"></asp:PlaceHolder>
<asp:PlaceHolder ID="PlaceHolderC" runat="server" Visible="False"></asp:PlaceHolder>
</td>
</tr>
<tr>
</tr>
</table>


</div>
</form>
</body>
</html>


default.aspx.cs sample code

using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{

if (ddlSelectone.SelectedIndex == 0)
{
PlaceHolderB.Visible = false;
PlaceHolderC.Visible = false;
PleacepholderA.Controls.Clear();
Control fuc = (UserControl)Page.LoadControl("~/A.ascx");
PleacepholderA.Controls.Add(fuc);
PleacepholderA.Visible = true;

}
}
else
{
if (ddlSelectone.SelectedIndex == 0)
{
PlaceHolderB.Visible = false;
PlaceHolderC.Visible = false;
Control fuc = (UserControl)Page.LoadControl("~/A.ascx");
PleacepholderA.Controls.Add(fuc);
PleacepholderA.Visible = true;
}
else if (ddlSelectone.SelectedIndex == 1)
{
PleacepholderA.Visible = false;
PlaceHolderC.Visible = false;
Control guc = (UserControl)Page.LoadControl("~/B.ascx");
PlaceHolderB.Controls.Add(guc);
PlaceHolderB.Visible = true;
}
else if (ddlSelectone.SelectedIndex == 2)
{
PlaceHolderB.Visible = false;
PleacepholderA.Visible = false;
Control huc = (UserControl)Page.LoadControl("~/C.ascx");
PlaceHolderC.Controls.Add(huc);
PlaceHolderC.Visible = true;
}
else
{

}
}
}

}

A.ascx sample code


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="A.ascx.cs" Inherits="_1" %>

<table width="100%">
<tr>
<td align="center" colspan="5">
<table width="100%">
<tr height="35">
<td align="center" class="ele_button" valign="middle" width="20%">
<asp:LinkButton ID="lbview1" runat="server" Font-Bold="True" Font-Names="Verdana"
Font-Size="10pt" Font-Underline="False" ForeColor="Black" Height="100%"
Text="view1" Width="100%" OnClick="lbview1_Click"></asp:LinkButton></td>
<td align="center" class="ele_button" valign="middle" width="20%">
<asp:LinkButton ID="lbview2" runat="server" Font-Bold="True" Font-Names="Verdana"
Font-Size="10pt" Font-Underline="False" ForeColor="Black" Height="100%"
Text="view2" Width="100%" OnClick="lbview2_Click"></asp:LinkButton></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<asp:MultiView ID="MultiViewA" runat="server">
<asp:View ID="View1" runat="server">
<asp:CheckBox ID="cbxA1" runat="server" Text="A1" /></asp:View>
<asp:View ID="View2" runat="server">
<asp:CheckBox ID="cbxA2" runat="server" Text="A2" /></asp:View>
</asp:MultiView></td>
</tr>
</table>




A.ascx.cs file

sing System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _1 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}

protected void lbview1_Click(object sender, EventArgs e)
{
MultiViewA.ActiveViewIndex = 0;
}
protected void lbview2_Click(object sender, EventArgs e)
{
MultiViewA.ActiveViewIndex = 1;
}
}


wht should i do please sugesst in this regard pls send me a sample code as it would be helpfull.

thanks and regard
vijay
Jun 8 '07 #3
acoder
16,027 Expert Mod 8TB
I'm not too familiar with C#, ASP.NET, etc. so if you can give me the HTML, I can probably give you some pointers.
Jun 8 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: John Banta | last post by:
Hi, I have created a 12 month calendar where each day has a check box whereby the user can indicate if that day is available or not available for a certain event. The calendar is 'drawn' in a...
2
by: Edward | last post by:
The following html / javascript code produces a simple form with check boxes. There is also a checkbox that 'checks all' form checkboxes hotmail style: <html> <head> <title></title> </head>...
2
by: jimi_xyz | last post by:
Sorry if this isn't the correct group, i don't think there is a group for straight HTML. I am trying to create a type of search engine. There are two radio buttons at the top, in the middle there...
1
by: Steven Stewart | last post by:
Hi there, I have a form with a bound text box control and a frame with two unbound check boxes. When the user checks one of the check boxes, the bound text box control is set to a certain value...
1
by: Jim in Arizona | last post by:
I'm having dificulty figuring out how to process multiple check boxes on a web form. Let's say I have three check boxes: cbox1 cbox2 cbox3 The only way I can think of to code the...
1
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get...
10
by: tadisaus2 | last post by:
Hello, I want to have a user to check at least 2 check boxes and NO more than 2 boxes. I have different checkbox names because I stored each nam on different field. I tried this code but nothing...
4
by: it2051229 | last post by:
Well i'm having a problem with the compatibility of javascript and PHP multiple delete check box.. i used a javascript for the "CHECK ALL BOXES" just like yahoo mail.. so my input is something like...
3
by: student4lifer | last post by:
I thought the group check boxes would be parsed as an array, but the code below didn't print out as I expected. Could someone explain what I am missing? Thanks. ========== <html> <body>...
1
by: ghjk | last post by:
my php page has 7 check boxes. I stored checked values to database and retrive as binary values. This is the result array Array ( => 0 => 1 => 0 => 1 => 0 => 0 => 1 ) 1 means checked....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.