By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,028 Members | 1,945 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,028 IT Pros & Developers. It's quick & easy.

cannot gain access to controls

P: n/a
I have a datalist displaying parent information and a
datagrid presenting child information. The data is being
rendered just fine. The datagrid has template columns on
it that I cannot gain access to in my Itemcommand event
of the datalist.

When I press a button on the datalist, that brings me
into the Itemcommand event. I have access to the datagrid
control, but not any column controls on the datagrid. For
instance, my first column is a checkbox with an ID
of "Condition3" that I can't find. While debugging, I
have cycled thru the control items of the Datalist, and
cannot find any of the columns inside my datagrid (which
is inside my datalist).

Here is ItemTemplate portion of my Datalist with the HTML:
<code>
<ItemTemplate>
<asp:label
id=Name2 runat="server" Text='<%# DataBinder.Eval
(Container, "DataItem.Name")%>'>
</asp:label>
<asp:label
id=LockNumber2 runat="server" Text='<%# DataBinder.Eval
(Container, "DataItem.Lock_Number")%>'>
</asp:label>
<asp:label
id=LoanID2 runat="server" Text='<%# DataBinder.Eval
(Container, "DataItem.LoanID")%>' Visible="False">
</asp:label>
<p>

<asp:Button id="btnWaive" runat="server"
Text="Waive All Conditions"
CommandName="Waive"></asp:Button>&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button id="btnNoWaive" runat="server"
Text="Don't Waive Any Condtions"
CommandName="NoWaive"></asp:Button></p>
<asp:DataGrid
id=Datagrid3 runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#999999"
BorderStyle="None" BorderWidth="1px" CellPadding="3"
GridLines="Vertical" datasource='<%#
Container.DataItem.CreateChildView
("spMSSASPGetDistinctOutstandingConditionsInInvest orReview
StepspMSSASPGetOutstandingConditionsInInvestorRevi ewStep")
%>'>

<SelectedItemStyle Font-Bold="True"
ForeColor="White" BackColor="#008A8C"></SelectedItemStyle>

<AlternatingItemStyle
BackColor="Gainsboro"></AlternatingItemStyle>

<ItemStyle ForeColor="Black"
BackColor="#EEEEEE"></ItemStyle>

<HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#000084"></HeaderStyle>

<FooterStyle ForeColor="Black"
BackColor="#CCCCCC"></FooterStyle>
<Columns>

<asp:TemplateColumn>

<ItemTemplate>

<asp:checkbox runat="server"
id="Condition3"></asp:checkbox>

</ItemTemplate>

</asp:TemplateColumn>

<asp:BoundColumn DataField="Name" ReadOnly="True"
HeaderText="Name"></asp:BoundColumn>

<asp:TemplateColumn HeaderText="LoanID">

<ItemTemplate>

<asp:label runat="server" id="LoanID3"
Text='<%# DataBinder.Eval(Container, "DataItem.LoanID") %
'>


</asp:label>

</ItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Lock Number">

<ItemTemplate>

<asp:label runat="server"
id="LockNumber3" Text='<%# DataBinder.Eval
(Container, "DataItem.Lock_Number") %>'>

</asp:label>

</ItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Conditional Dtl
ID">

<ItemTemplate>

<asp:label runat="server"
id="ConditionDetailID3" Text='<%# DataBinder.Eval
(Container, "DataItem.ConditionDetailID") %>'>

</asp:label>

</ItemTemplate>

</asp:TemplateColumn>

<asp:BoundColumn DataField="ConditionID"
ReadOnly="True"
HeaderText="ConditionID"></asp:BoundColumn>

<asp:BoundColumn DataField="Description"
ReadOnly="True"
HeaderText="Description"></asp:BoundColumn>

<asp:BoundColumn DataField="Comment"
ReadOnly="True" HeaderText="Comment"></asp:BoundColumn>
</Columns>

<PagerStyle HorizontalAlign="Center"
ForeColor="Black" BackColor="#999999"
Mode="NumericPages"></PagerStyle>
</asp:DataGrid>
</ItemTemplate>
</code>

Here is the code-behind where I'm trying to access the
checkbox:
<code>
Private Sub DataList2_ItemCommand(ByVal source As Object,
ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs )
Handles DataList2.ItemCommand

Dim dgChild As DataGrid = e.Item.FindControl
("DataGrid3")
Dim chkCondition As CheckBox = e.Item.FindControl
("Condition3")
..
..
..
</code>

In the first line above, I gain access to my datagird.
However, the next line, I don't have any access to my
columns within my datagrid.

How can I gain access to these column controls within my
datagrid???
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.