473,507 Members | 5,060 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

checking one checkbox with other Checkbox present in different views of a multiview

22 New Member
i am having a web based application and i am having a problem with it pls check it
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 #1
0 1417

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

Similar topics

4
6142
by: Shufen | last post by:
Hi, I'm a newbie that just started to learn python, html and etc. I have some questions to ask and hope that someone can help me on. I'm trying to code a python script (with HTML) to get...
3
1405
by: Wendy S | last post by:
I have this working, but I don't think it's done efficiently or the best way: <a href="javascript:setAllAccounts(true)">check all</a> <a href="javascript:setAllAccounts(false)">clear all</a> ...
67
4193
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
0
1793
by: Fabuloussites | last post by:
I have a page that has multiview control that has two dropdown lists on it. the dropdown controls ARE NOT inside of the multiview. Each drop down is bound using its own sqldatasource conrtol. The...
2
7386
by: Venkata Narayana | last post by:
Hi, You all may be knowing that Connection.isClosed() does not tells us if the underying DB connection is active or not; it only checks if Connection.close() had been previously called or not....
0
2386
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
3
2214
by: cvijaykrishna | last post by:
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 ...
4
1840
by: cvijaykrishna | last post by:
hi, i am having an apllication which has a multiview if i check one checkbox in a view other checkboxin another view should get checked . i am using server side script and getting it but for...
0
911
by: Joe | last post by:
This is another one of those things which I think isn't going to work the way I want... I have a MultiView on a page with 5 views. The use each view as a page. At the bottom of each page there...
0
7223
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
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.