Access User Control DataGrid Controls from parent page

G

Guest

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>
 
I

IPGrunt

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"> said:
<HeaderStyle Font-
Bold="True" BorderWidth="0px" BorderStyle="Solid"
BorderColor="White" CssClass="FoldersHeader"></HeaderStyle>
<Columns>
<asp:BoundColumn
Visible="False">
<HeaderTemplate>
<asp:CheckBo
x id="allmsg" runat="server" AutoPostBack="False"
onclick="javascript:SelectAll(this);"
Tooltip
s="Select/DeSelect All"> said:
</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"
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.FindControl("delMsg");

then test:

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


cheers,

-- ipgrunt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top