Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Access dropdownlist Nested in GridView in ItemTemplate Formview

Reply
Thread Tools

Access dropdownlist Nested in GridView in ItemTemplate Formview

 
 
sgtmarcjones@yahoo.com
Guest
Posts: n/a
 
      03-27-2007
How do I access a dropdownlist that is nested within a Formview
ItemTemplate Gridview Template?

I want to see a label (lgbTimeKeep ! TextValue of ddlName
dropdownlist) instead of a dropdownlist in the FormView ItemTemplate
Nested Gridview ddlName ItemTemplate. My label is named lgvTimeKeep
and the dropdownlist name is ddlName.

Thanks!

MCJ

Below is some sample code:

<ItemTemplate>
<asp:Label ID="Time_IDLabel" runat="server" Text='<%#
Eval("Time_ID") %>' style="left: 137px; position: absolute; top: 77px"
Font-Size="Small" ForeColor="Red" Width="160px"></asp:Label>
<asp:Label ID="lAmount" runat="server" Font-Size="Small"
Style="left: 24px; position: absolute;
top: 188px" Text="Amount" Width="106px"></asp:Label>

<br />
<asp:Label ID="D_NumberLabel" runat="server" Text='<%#
Bind("D_Number") %>' style="left: 137px; position: absolute; top:
133px" Font-Size="Small" Width="160px"></asp:Label>
<asp:Label ID="lDNumber" runat="server" Font-Size="Small"
Style="left: 21px;
position: absolute; top: 133px" Text="D Number"
Width="110px"></asp:Label>
<asp:Label ID="lRate" runat="server" Font-Size="Small"
Style="left: 24px; position: absolute; top: 161px"
Text="Rate" Width="106px"></asp:Label>
<asp:Label ID="lLocation" runat="server" Font-Size="Small"
Style="left: 24px; position: absolute; top: 215px"
Text="Location" Width="104px"></asp:Label>

&nbsp;<br />

&nbsp;

<asp:TextBox ID="txt_Style" runat="server"
BorderColor="Gray" BorderWidth="1px"

Font-Size="X-Small" Height="75px" Style="left: 625px;
position: absolute; top: 135px"

TextMode="MultiLine"
OnTextChanged="txt_Style_TextChanged" BorderStyle="Inset"
OnPreRender="txt_Style_PreRender" Width="169px"></asp:TextBox>

<asp:Label ID="lTimeKeeper" runat="server" Font-
Size="Small" Style="left: 24px; position: absolute;

top: 104px" Text="Time Keeper" Width="106px"></
asp:Label>

&nbsp;

<asp:Label ID="lComments" runat="server" Font-Size="Small"
Height="43px" Style="left: 24px;

position: absolute; top: 244px" Text="Comments/Notes"
Width="106px"></asp:Label>

&nbsp;&nbsp;
<asp:Label ID="lblDAmount" runat="server" Font-
Size="Small" Style="left: 534px; position: absolute;
top: 291px"></asp:Label>
<asp:Label ID="lblTimeKeeper" runat="server" Font-
Size="Small" OnPreRender="lblTimeKeeper_PreRender"
Style="left: 137px; position: absolute; top: 104px"
Width="137px"></asp:Label>
&nbsp; &nbsp;&nbsp;
<asp:Label ID="lblBHour" runat="server" Font-Size="Small"
OnPreRender="lblBHour_PreRender"
Style="left: 534px; position: absolute; top: 239px"
Width="97px"></asp:Label>
<asp:Label ID="lBilled" runat="server" Font-Size="Small"
Style="left: 396px; position: absolute;
top: 239px" Width="138px">Total Billed Hours</
asp:Label>
<asp:Label ID="lNonBilled" runat="server" Font-
Size="Small" Style="left: 396px; position: absolute;
top: 264px" Width="138px">Total Non-Billed Hours</
asp:Label>
<asp:Label ID="lTotal" runat="server" Font-Size="Small"
Style="left: 396px; position: absolute;
top: 291px" Width="138px">Total Dollar Amount</
asp:Label>
<asp:Label ID="lblNBHour" runat="server" Font-Size="Small"
Style="left: 534px; position: absolute;
top: 264px" Width="97px"></asp:Label>
<br />
&nbsp;
<asp:LinkButton ID="lbtnDetails" runat="server"
CausesValidation="False" Font-Size="Small"
OnClick="lbtnDetails_Click" Style="left: 369px;
position: absolute; top: 137px"
Width="78px">View Details</asp:LinkButton>
<asp:TextBox ID="txtOutput" runat="server"
BorderColor="Red" BorderStyle="Dashed"
Font-Bold="True" Font-Size="XX-Small" Height="96px"
ReadOnly="True" Rows="2"
Style="z-index: 134; left: 687px; position: absolute;
top: 220px" TextMode="MultiLine"
ToolTip="Messages" Visible="False" Width="106px"></
asp:TextBox>
<asp:SqlDataSource ID="sqlLocation" runat="server"
ConnectionString="<%$ ConnectionStrings:conTime_Keep %>"
SelectCommand="SELECT [LocationID], [Location_Desc]
FROM [v_Location] ORDER BY [Location_Desc]">
</asp:SqlDataSource><aspropDownList
ID="ddlTime_Keeper_ID" runat="server"
DataSourceID="sqlTime_Keeper_Name"
DataTextField="Name" DataValueField="Emp_IDX" Font-
Size="Small" SelectedValue='<%# Bind("Time_Keeper_ID") %>'
Style="left: 189px; position: absolute; top: 104px"
Width="108px" Visible="False">
</aspropDownList>
<aspropDownList ID="ddlLocation" runat="server"
DataSourceID="sqlLocation" DataTextField="Location_Desc"
DataValueField="LocationID" Font-Size="Small"
SelectedValue='<%# Bind("Location") %>'
Style="left: 222px; position: absolute; top: 215px"
Width="75px" Visible="False">
</aspropDownList>
<asp:Label ID="lTime" runat="server" Font-Size="Small"
Style="left: 519px; position: absolute;
top: 78px" Text="Time" Width="97px"></asp:Label>
<asp:Label ID="lDate" runat="server" Font-Size="Small"
Style="left: 519px; position: absolute;
top: 107px" Text="Date" Width="97px"></asp:Label>
<asp:Label ID="Label1" runat="server" Font-Size="Small"
Style="left: 519px; position: absolute;
top: 135px" Text="Case Style/Name" Width="97px"></
asp:Label>
<asp:Label ID="lRecordID" runat="server" Font-Size="Small"
Style="left: 24px; position: absolute;
top: 77px" Text="Record ID" Width="106px"></asp:Label>
<asp:Label ID="lEvents" runat="server" Font-Size="Small"
Style="left: 24px; position: absolute;
top: 311px" Text="Events" Width="106px"></
asp:Label> &nbsp; &nbsp;
<br />
<asp:CheckBox ID="chkBillStatus" runat="server" Checked='<
%# Bind("Bill_Status_ID") %>'
Font-Size="Small" Height="18px" Style="left: 325px;
position: absolute; top: 185px"
Text="Billable Hours?" Width="133px" Enabled="False" /
>

<asp:Label ID="lblLocation" runat="server" Font-
Size="Small" OnPreRender="lblLocation_PreRender"
Style="left: 137px; position: absolute; top: 215px"
Width="160px"></asp:Label>
<asp:Label ID="lDetails" runat="server" Font-Size="Small"
Style="left: 22px; position: absolute;
top: 537px" Text="Time Events and Details"
Width="163px" Font-Bold="True" Visible="False"></asp:Label>
<asp:GridView ID="gvMain" runat="server"
AutoGenerateColumns="False" DataKeyNames="Time_ID"
DataSourceID="sqlGVMain1" Font-Size="X-Small"
Style="left: 27px; position: absolute;
top: 552px" BorderColor="Gray" BackColor="Transparent"
Width="758px" AllowSorting="True" GridLines="None" Visible="False">
<Columns>
<asp:BoundField DataField="Time_ID"
HeaderText="ID#" InsertVisible="False" ReadOnly="True"
SortExpression="Time_ID" >
<ItemStyle HorizontalAlign="Left" />
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:TemplateField HeaderText="Time Keeper"
SortExpression="Time_Keeper_ID">
<EditItemTemplate>
<aspropDownList ID="ddlName"
runat="server" DataSourceID="sqlTime_Keeper_Name"
DataTextField="Name"
DataValueField="Emp_IDX" Font-Size="X-Small" SelectedValue='<%#
Bind("Time_Keeper_ID") %>'
Width="120px">
</aspropDownList>
</EditItemTemplate>
<ItemStyle HorizontalAlign="Left"
Width="110px" />
<ItemTemplate>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
access dropdownlist in edit itemtemplate on SelectedIndexChanged event gridview fnuser ASP .Net Datagrid Control 0 01-26-2013 08:57 AM
embeding databound DropDownList in FormView spoils DropDownList ev Lagrange ASP .Net Web Controls 1 01-17-2009 08:31 AM
Simple question - Make Label1 = Bound Field in ItemTemplate of Formview Phillip Vong ASP .Net 0 08-22-2006 04:06 PM
strange inconsistency referencing controls in Formview itemtemplate Ned Balzer ASP .Net 4 08-03-2006 05:14 PM
can code inside a Repeater's ItemTemplate modify controls in the ItemTemplate? Bennett Haselton ASP .Net 1 09-24-2004 01:59 AM



Advertisments