Click here to Skip to main content
       

JavaScript

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questionxna4life Member 13 Points 71 Posts hard code drop down instead of using toolbar and r/smemberxnaLearner21 Dec '12 - 3:34 
So im trying to creae a dynamic data project using asp.net.
 
my project has 2 tables, FruitTable and SellerTable.
 
I had it set so the primary key in 'fruit table': name. was the foreign key in 'seller table'
 
I added a new class which contains the code to link to the new fieldTemplate I added(DropDown)
 
 <pre lang="c#">[MetadataType(typeof(UsingDropDownMetadata))]
    public partial class UsingDropDown
    {
    }
 
    public class UsingDropDownMetadata
    {
        //DropDown is name of field templates
        [UIHint("DropDown")]
        //use in field date in tracing table
        public object DropDownFromTextBox { get; set; }
    }
then in the dropDown_Edit.ascx I used the toolbox to get a drop down list and link it to the fruit table.
 
Now when a user creates a new item, they can select the names of fruit to add.
 
However I would like to hard code this so I have removed the r/s btn fruit and seller table
 
In dropdownEdit.ascx iv added it manuall
 
<asp:DropDownList id="DropDownList1" runat="server"
DataSource="<% databindingexpression %>"
DataTextField="DataSourceField"
DataValueField="DataSourceField"
AutoPostBack="True|False"
OnSelectedIndexChanged="OnSelectedIndexChangedMethod">
 
<asp:ListItem value="value" selected="True|False">
Text
</asp:ListItem>
 
</asp:DropDownList>
then in the dropdownedit.ascx.cs
 
I want to hard code to pull across the values but am not sure if I am doing this right. please advise
 
protected void OnSelectedIndexChangedMethod(object sender, EventArgs e)
{
 
//text here

}

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 22 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid