|
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)
{
}
|
|
|
|