473,500 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access User Control DataGrid Controls from parent page

i have aspx page with user control containing a datagrid , the datagrid has
TempleteColumn with checkbox in header and item ( doing multiselect task)
I wondering how Can get the checkboxes status from aspx page

this is my datagrid in the user control
<asp:datagrid id="dgFoldersInfo" runat="server" BorderColor="Black"
BorderWidth="0px" HeaderStyle-CssClass="tableHeaderCell"
ShowFooter="True" CellPadding="3" GridLines="Horizontal"
Font-Size="11px" Font-Names="Tahoma" Width="100%"
AutoGenerateColumns="False">
<ItemStyle CssClass="Inboxarea"></ItemStyle>
<HeaderStyle Font-Bold="True" BorderWidth="0px" BorderStyle="Solid"
BorderColor="White" CssClass="FoldersHeader"></HeaderStyle>
<Columns>
<asp:BoundColumn ReadOnly="True"></asp:BoundColumn>
<asp:TemplateColumn Visible="False">
<HeaderTemplate>
<asp:CheckBox id="allmsg" runat="server" AutoPostBack="False"
onclick="javascript:SelectAll(this);"
Tooltips="Select/DeSelect All"></asp:CheckBox>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox id="delmsg" runat="server" AutoPostBack="False"
onclick="refresh(this);"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="OK"
CancelText="Cancel" EditText="Rename"></asp:EditCommandColumn>
<asp:ButtonColumn Text="Delete"
CommandName="Delete"></asp:ButtonColumn>
<asp:BoundColumn DataField="FolderName"
HeaderText="Folders"></asp:BoundColumn>
<asp:BoundColumn DataField="Messages" ReadOnly="True"
HeaderText="Messages"></asp:BoundColumn>
<asp:BoundColumn DataField="Unread" ReadOnly="True"
HeaderText="Unread"></asp:BoundColumn>
<asp:BoundColumn DataField="Size" ReadOnly="True"
HeaderText="Size"></asp:BoundColumn>
<asp:BoundColumn Visible="False" DataField="FolderName"
ReadOnly="True" HeaderText="FoldersCopy"></asp:BoundColumn>
</Columns>
</asp:datagrid>
Nov 19 '05 #1
1 5827
On 16 Feb 2005, =?Utf-8?B?UmFlZCBTYXdhbGhh?=
<Ra*********@discussions.microsoft.com> postulated in news:6AA1438D-
71*************************@microsoft.com:
i have aspx page with user control containing a datagrid , the datagrid has TempleteColumn with checkbox in header and item ( doing multiselect task) I wondering how Can get the checkboxes status from aspx page

this is my datagrid in the user control
<asp:datagrid id="dgFoldersInfo" runat="server" BorderColor="Black" BorderWidth="0px" HeaderStyle-CssClass="tableHeaderCell"
ShowFooter="True" CellPadding="3" GridLines="Horizontal" Font-Size="11px" Font-Names="Tahoma" Width="100%"
AutoGenerateColumns="False"

<ItemStyle CssClass="Inboxarea"></ItemStyle> <HeaderStyle Font- Bold="True" BorderWidth="0px" BorderStyle="Solid" BorderColor="White" CssClass="FoldersHeader"></HeaderStyle>
<Columns>
<asp:BoundColumn ReadOnly="True"></asp:BoundColumn> <asp:TemplateColumn Visible="False"> <HeaderTemplate>
<asp:CheckBo x id="allmsg" runat="server" AutoPostBack="False" onclick="javascript:SelectAll(this);"
Tooltip s="Select/DeSelect All"></asp:CheckBox> </HeaderTemplate>
<ItemTemplate>
<asp:CheckBo x id="delmsg" runat="server" AutoPostBack="False" onclick="refresh(this);"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="OK" CancelText="Cancel" EditText="Rename"></asp:EditCommandColumn>
<asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
<asp:BoundColumn DataField="FolderName" HeaderText="Folders"></asp:BoundColumn>
<asp:BoundColumn DataField="Messages" ReadOnly="True" HeaderText="Messages"></asp:BoundColumn>
<asp:BoundColumn DataField="Unread" ReadOnly="True" HeaderText="Unread"></asp:BoundColumn>
<asp:BoundColumn DataField="Size" ReadOnly="True" HeaderText="Size"></asp:BoundColumn>
<asp:BoundColumn Visible="False" DataField="FolderName" ReadOnly="True" HeaderText="FoldersCopy"></asp:BoundColumn>
</Columns>
</asp:datagrid>


Ugh! Too much code.

How about in the code behind page, using

dgFoldersInfo.delMsg.Checked ?

or specifically, you must first find the control in the list,
something like:

CheckBox delMsg =
(CheckBox) dgFoldersInfo.Items[i].FindControl("delMsg");

then test:

if (delMsg.Checked == true) ...
cheers,

-- ipgrunt

Nov 19 '05 #2

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

Similar topics

9
1902
by: Max | last post by:
How do I reference a datagrid on a page from a user control on that page? In my user control, I'd like to have something like this... MyDataGrid being on the page, not in the user control... I...
1
7536
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
1
1738
by: bill yeager | last post by:
I did some more debugging and found the following: 1) I placed the following code in the button event just to see if I could cycle thru the datagrid control collection: <code> Dim strhello As...
4
2431
by: Josh Harris | last post by:
Here is my question: It is common to have many pieces of business logic encapsulated within asp.net user controls. This can be found in high visibility projects such as the iBuySpy portal from...
2
2189
by: Quentin Huo | last post by:
Hi: I have a user control and I want to dynamically create a Label control and TextBox control when the button "add more author name" is clicked. I did like this: 1. there is a...
9
2435
by: Anders K. Jacobsen [DK] | last post by:
Hi I have this that adds some usercontrol (UCTodays.ascx) to a placeholder foreach(A a in B){ UCTodays ucline = (UCTodays )LoadControl("UCTodays.ascx");...
2
2201
by: Hexman | last post by:
Off on another journey through vb.net. What I want to do now is have a tab-control with 1 to 8 tab-pages for categories. I've read where there is not a hide method so I guess I'll have to...
1
1937
by: engwar | last post by:
I have a page that my users will go to to upload files to my website. As I want to reuse the file upload code on multiple pages I put the file upload textbox/buttons on a user control which I plan...
3
3898
by: Mark Rae | last post by:
Hi, Just a general quickie on setting properties of user controls from the parent form. Let's say I have a user control called note.ascx which displays a datagrid. That datagrid is populated...
0
7136
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
7232
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...
1
6906
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7397
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...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3110
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
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
316
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.