Access dropdownlist Nested in GridView in ItemTemplate Formview

Discussion in 'ASP .Net' started by sgtmarcjones@yahoo.com, Mar 27, 2007.

  1. Guest

    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><asp:DropDownList
    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">
    </asp:DropDownList>
    <asp:DropDownList 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">
    </asp:DropDownList>
    <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>
    <asp:DropDownList ID="ddlName"
    runat="server" DataSourceID="sqlTime_Keeper_Name"
    DataTextField="Name"
    DataValueField="Emp_IDX" Font-Size="X-Small" SelectedValue='<%#
    Bind("Time_Keeper_ID") %>'
    Width="120px">
    </asp:DropDownList>
    </EditItemTemplate>
    <ItemStyle HorizontalAlign="Left"
    Width="110px" />
    <ItemTemplate>
     
    , Mar 27, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bennett Haselton
    Replies:
    1
    Views:
    5,384
    Joe Fallon
    Sep 24, 2004
  2. Ned Balzer
    Replies:
    4
    Views:
    2,464
    Ned Balzer
    Aug 3, 2006
  3. Phillip Vong
    Replies:
    0
    Views:
    488
    Phillip Vong
    Aug 22, 2006
  4. Max2006
    Replies:
    4
    Views:
    1,376
    Walter Wang [MSFT]
    Aug 29, 2007
  5. fnuser
    Replies:
    0
    Views:
    2,373
    fnuser
    Jan 26, 2013
Loading...

Share This Page