Search
Saturday, September 04, 2010 ..:: Home ::.. Register  Login
 .NET Links Minimize

 Print   
 My Links Minimize

 Print   
 Recent Blog Entries Minimize
Dec 20

Written by: Wil Dobson
12/20/2007 12:46 PM

Here is an example from a FormView where I have an hidden Textbox containing an ID from a child table, which is related to an entry in a primary table.

This is just one example of many controls I have in this FormView... it is bound to a single ID in my DataSource.  You will see the DropDownList (representing a friendly listing of possible IDs for my FormView field) has its own DataSource in there with it.  The sdsApplicationNames DS populates my dropdownlist.  The Dropdownlist has an event which (during autopostback) calls a SelectedIndexChanged method (This will also be below).  The initial value of the hidden field is handled naturally in the FormView and its Datasource, but the DropDownList's initially selected value is handeld in the event handler for the DropdownList.DataBound event (will also be below)

<EditItemTemplate>
                    APPLICATION:<br />
                    <asp:TextBox ID="APPLICATION_IDTextBox" runat="server" 
                    Text='<%# Bind("APPLICATION_ID", "{0}") %>'
                        Visible="False" Width="56px"></asp:TextBox>

                    <asp:DropDownList ID="ddlEditApplicationNames" runat="server" 
                        AppendDataBoundItems="True"
                        AutoPostBack="True" DataSourceID="sdsApplicationNames" 
                        DataTextField="NAME" DataValueField="APPLICATION_ID"
                        OnDataBound="ddlEditApplicationNames_DataBound" 
                        OnSelectedIndexChanged="ddlEditApplicationNames_SelectedIndexChanged">
                        <asp:ListItem Selected="True"Copyright ©2007 Wil Dobson
  

Tags:

  
 PS: Minimize

 Print   
 Sponsors Minimize

Get your own Komets drinking Stein!

Get your KOMETS gear!
Proceeds go for player awards @ the end of each season.

  Quality Geek Gear from GeeksWithGuns.com

We use DiscountASP!! Click to join up!


 Print   
 Facebook Minimize

Wil Dobson's Facebook profile


 Print   
 Blogs Minimize

 Print   
 Manage Blog Minimize
You must be logged in and have permission to create or edit a blog.

 Print   
 Blog Archives Minimize

 Print   
Copyright 2008 by Wil Dobson   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2010 by DotNetNuke Corporation