473,787 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determine view in Datagrid based on Checkbox selected

Hi guys,

I'm having trouble getting my Datagrid to display according to
Checkboxes checked values.

On my Checkboxes, I have 5 values :-
1) Apartment/Condo
2) Executive Condo
3) Detached
4) Semi-detached
5) Terrace

On my Datagrid, 2 columns r displayed according to what is Checked.
The columns :-
1)Floor Area
2)Land Area

This is how it goes..
(a)When Apartment/Executive Cdo is Checked, Land Area is not supposed to
be shown.
(b)When Detached/Semi-detached/Terrace is Checked, Floor Area is not
supposed to be shown.
(c)Naturally, if both items from (a) & (b) r Checked, both Land Area &
Floor Area should be shown.
Can somebody tell me how this should be done?

best regards,
xianxian

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #1
3 1591
Hi xianxian,

You can set visibility of Floor Area/Land Area in datadrid_ItemDa tabound
event:

if (e.Item.ItemTyp e == ListItemType.It em || e.Item.ItemType ==
ListItemType.Al ternatingItem){
// according to condition
e.Item.Cells[Floor_index].Visible = true/false;
e.Item.Cells[Land_index].Visible = true/false;
}

HTH

Elton Wang
el********@hotm ail.com
"xianxian" wrote:
Hi guys,

I'm having trouble getting my Datagrid to display according to
Checkboxes checked values.

On my Checkboxes, I have 5 values :-
1) Apartment/Condo
2) Executive Condo
3) Detached
4) Semi-detached
5) Terrace

On my Datagrid, 2 columns r displayed according to what is Checked.
The columns :-
1)Floor Area
2)Land Area

This is how it goes..
(a)When Apartment/Executive Cdo is Checked, Land Area is not supposed to
be shown.
(b)When Detached/Semi-detached/Terrace is Checked, Floor Area is not
supposed to be shown.
(c)Naturally, if both items from (a) & (b) r Checked, both Land Area &
Floor Area should be shown.
Can somebody tell me how this should be done?

best regards,
xianxian

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #2
Hi,

im sorry i didn specify to u further :-

1)The CheckBoxList & the Datagrid are on 2 separate web pages.
CheckboxList is on "Search" page, Datagrid on "Results" page.
2)i have stored all user's Checked values in ArrayList, so i can Loop
the ArrayList on "Results" page & get what is selected.

From the Loop, i can set the Visible property of the Datagrid column to
true/false. But i was lost admist all the Looping..
For i = 0 To a.Count - 1

Select Case p.GetItem(i)

Case 0, 1
dgProject.Colum ns.Item(3).Visi ble = False
Case 2
dgProject.Colum ns.Item(2).Visi ble = True
If Not dgProject.Colum ns.Item(3).Visi ble = False Then
dgProject.Colum ns.Item(2).Visi ble = False
Else
dgProject.Colum ns.Item(3).Visi ble = True
End If
Case 3
...
Case 4
...
End Select
Next
**p.GetItem(i) returns 0,1,2,3, or 4.
These 5 values are the Apartment/Executive Cdo, Detached, Semi-Detached
& Terrace respectively.

**dgProject.Col umns.Item(2) is the column "Floor Area"
dgProject.Colum ns.Item(3) is "Land Area"

-----------------------------------------------------
For Case 2 it works.. but if i use its Loop in Case 3 & 4, it won't
work.
ie. When Apartment/Executive Cdo, Detached & Semi-Detached are Checked,
only "Land Area" is shown.

I am lost for Case 3 & 4.. i don't know how to Loop in there.

What should i do ?

thanks,
xianxian

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #3
hi,

i have solved the looping. Thank u very much for trying to help :)

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2161
by: Just D | last post by:
Hi All, Does anybody know how to write the following code? I have a database table with a few columns including: ID , "Task" , ForceRun . I need to show the DataGrid on the ASPX page with these selected fields and allow user to click one or more CheckBox controls to activate this bit on the database table for a required ID. I have already added a template column to the DataGrid and I can get the
0
1392
by: Krish | last post by:
Hello Gurus, Pl. help. I need to validate a control in datagrid based on check box selection. Basically in a datagrid i have checkbox and textbox control for edititemtemplate. If checkbox is selected i valid entry in textbox , if checkbox is not selected , no entry should be made in textbox. How do i write this...in csharp.. I tried this ...but not sure how to continue
5
3010
by: TPS | last post by:
I have a checkbox column in my datagrid. This checkbox triggers an autopostback. When I postback, I need to tell what row the user is on so I can tell what check box was checked or unchecked. Can't seem to find that property. Thanks.
2
2440
by: Bob Hollness | last post by:
Hi group. I am a newbie to ASP.NET as you will see from some of the questions I may ask! I have a datagrid which I have populated from a database. It works great! I have added a column, via the Columns dialog box from the properties of the datagrid, on the left that contains a select button. So now, when you press the button the whole row is highlighted. Now, what I want to do is have the user highlight as many rows as they wish...
2
2468
by: Mortar | last post by:
i have a datagrid with 2 columns. the 1st column contains an id which will be used by the database for the selected checkbox records. the 2nd column is a template column containing a server checkbox control. where i'm at: i can retrieve a count of the selected checkboxes, but don't know how to get the related id's (in the 1st column).
12
2220
by: Raed Sawalha | last post by:
I have the following table which i can not switcha to design view error message said Could not open in Design view. Quote values differently inside a '<% ...."value"... %>' block. and the line which make the error is anchor but i cannot make it work. <TABLE id="tblDocList" dir="<%#strLangDir%>" style="DISPLAY:inline"
1
1948
by: mamun | last post by:
Hi All, I have the following situation. In the aspx page, I have a datagrid and getting values from the database. I am displaying checkbox in each row of the grid. At the top of the grid I have an "Update" button which will be used to update the contents based on Bore_Id field. This field in the database is Number
4
7504
by: mamun | last post by:
Hi All, I have the following situation and am looking for answer in C#. I have a datagrid and putting checkbox next to each record. In the header I have a Delete button. I want users to checkchekboxes and click the Delete button. That will show a confirmation dialog message with the items they choose to delete.
3
3492
by: | last post by:
Hi all, I have a CheckBoxList control which has about 10 items. I have set autopostback=true and also set an eventhandler for OnSelectedIndexChanged. The problem is I want to identify which checkbox item caused the event to fire to perform some routines based upon the value of that individual checkbox. How can I determine this? For example, 5 of the 10 items maybe checked. However, when I uncheck one, I want to perform some code based...
0
9655
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.