Dynamic Data Website, Foreign Key One To One Relationship, DropdownList, How To Customise

Mar 15, 2010

I'm using Asp.Net's Dynamic Data Website project type.I've created a db that has one to onerelationship between two tables specified using a foreign key, (this could be one to many but I've used the linq designer to change it to a one to one relationship).i.e. I have a table Invoice and table CreditNote that takes an Invoice_Id as a foreign keyI was hoping that when I navigated to CreditNotes/Insert.aspx that it would display the a list of InvoiceIds in a dropdown list. It almost does this - it creates dropdownlist but only populates option value and not the text so I get something like this in the html source (notice only the value is populated - which looks empty to the user):

<select>
<option value="someInvoiceId"></option>
<option value="someInvoiceId"></option>
</select>

View 1 Replies


Similar Messages:

Dynamic Data Foreign Key Table Display Name?

Nov 26, 2010

I have these two tables in my diagram:

the 1st:
PAR_TipiDocumento with
idTipoDocumento PK
idClasseDocumento
[...]

the 2nd:
PAR_ClassiDocumento with
idClasseDocumento PK
[...]

and a foreing key FK_PAR_TipiDocumento_PAR_ClassiDocumento from PAR_TipiDocumento.idClasseDocumentoto PAR_ClassiDocumento.idClasseDocumento.

This is my .cs code for the metadata:

[MetadataType(typeof(PAR_TipiDocumento_Metadata))]
[DisplayName("Tipi Documento")]
public partial class PAR_TipiDocumento[code]....

The problem is that in the Dynamic Data generated pages I correctly see all the display names "Tipi Documento" except for the header row of the PAR_ClassiDocumento table where I have "PAR_TipiDocumentos" (the plural generated by LINQ to SQL). The values under this column are correctly rendered as links to the PAR_TipiDocumento table with the right display name ("View Tipi Documento").

How can I change the Display Name of that "PAR_TipiDocumentos"?

View 1 Replies

Insert Foreign Keys With Dynamic Data?

Mar 21, 2011

I am having trouble with foreign keys Dynamic Data and entity framework 4.0. It feels like there is a problem with the entity association but I am not sure. I have multiple fields representing the foreign key on the insert page.

When I try and insert data I get an error A dependent property in a ReferentialConstraint is mapped to a store-generated column.

Column: 'CommentId'

My data is a very basic one to many relationship, the foreign key in question is BookId in the Comment Table.

[code]...

When I let the scaffolding do its thing, I get multiple fields representing the foreign key.

View 1 Replies

Displaying Values For Foreign Keys In Dynamic Data Web App?

Nov 4, 2010

I have the following tables in my database which are as given under:

[code]...

My requirement is instead of getting the PromotionID values displayed for columns CustomerPromotionDiscountID & EmployeePromotionDiscountID, it should display the respective DiscountAmount. Which is not happenning for some reason.

I somehow found a workaround where if i define the datatype for columns CustomerPromotionDiscountID and EmployeePromotionDiscountID as nchar or nvarchar, it displays the DiscountAmount.

Wanted to know if there is any better way of doing this without changing the datatype for my columns?

View 1 Replies

Forms Data Controls :: Show Data Relationship In Gridview With Dropdownlist Or Similar?

May 24, 2010

I have data coming from two tables with a foreign key relationship - one User table containing users of the web application, and one Page table containing details about pages visited by each user.I would like to be able to view these data in a gridview or the like on a page. It's easy enough to just show the User table data like so (I'm using the Entity Framework and LINQ):

[Code]....

But how can I show the Page details? I'm not bent on any particular way of showing it, but the only idea I've been able to come up with is to have a dropdown list for each user in a column. But I can't figure out how to get the page data into such a dropdown list. The tables are associated with the primary/foreign key UserID.The closest I've come to finding something similar to this is this for Linq2SQL: http://weblogs.asp.net/scottgu/archive/2007/07/16/linq-to-sql-part-5-binding-ui-using-the-asp-linqdatasource-control.aspx , and this using more traditional data access: ttp://www.highoncoding.com/Articles/169_DropDownList_Inside_GridView__Method_1_.aspx . Either way, regardless of data access technology, I can't relate these solutions to my example and get it to work

View 5 Replies

C# - Combining Multiple Fields In C# Dynamic Data Foreign Key Display?

Sep 30, 2010

I have two tables (Person and Location) In the Dynamic Data Site, when adding Location info, I am need to choose a person from the dropdown box which is populated via a FK. That dropdown box defaults to the field in "Person" that is titled "fname" which is first name, so it looks like "Jim" or "Steve".

I'm trying to have that dropdown box display the full name of the person it references which would be combining the fields fname and lname.

Would I do this inside a Field Template? Metadata? I'm kind of stuck on this.

If I look at the FieldTemplate for ForeignKey_Edit I see this:

[code]...

and it seems like I should be able to make something similar to "PopulateListControl" and use that instead, but I have no idea where this method even resides.

View 1 Replies

Forms Data Controls :: Dropdownlist That Maps From A SQL Foreign Key, Which Can Be NULL?

Jan 12, 2011

This must be a common problem but I haven't been able to find an answer.I have dropdownlist that maps from a SQL foreign key, which can be NULL. Currently, I've added a "Please select..." to the top of my dropdown list and assigned it a value of 0.I know how to map from the drop down list to SQL using a CASE statement in my UpdateCommand.But how to I map from the SELECT statement to my dropdownlist? If this foreign key contains null I get "Item not in Dropdown list". I'd like to show "Please Select..." as the dropdownlist item if the SQL item contains NULL. I saw something online that says to use the value '''' for 'Please select...', but I don't think it's right, plus it doesn't work.Do I have to do something in my SELECT statement or do I have to do something on DDL.Databind?

View 2 Replies

Customise The Url For Different Users?

Feb 23, 2010

i have one site , on which i have to personalize the content of site as Per different user.i want the different url for different user to acchieve personalization,for eg.for user1 http://abcdxyz.com/user1for user2http://abcdxyz.com/user2Please let me know which techqique will help me.

View 8 Replies

Placing A Foreign Website Into Master Page

Oct 19, 2010

I just started at a new job as a asp.net developer. The place I am working, a small college, has several web pages made with old school html, vbscript, php, and asp (not asp.net). My boss wants their websites to have a menu system to navigate through the pages. I started a asp.net master page with a header, footer, and menu on the left. However, now, I am trying to get the school's websites to appear in the contentplaceholder. Is there someway to insert a pages content (example www.google.com) into the contentplaceholder? I was thinking of using a combination of frames and asp master pages but all I get are errors so far.

View 3 Replies

Localization :: Website Translation And Compile All Of The Text Into A New Application In The Foreign Language?

Jun 2, 2010

I want a program that can keep track of all components that need translation (labels, strings, fields), and then I can give the pieces to a person to translate and gather the translated text back into to the program and it will compile all of the text into a new application in the foreign language. I did find Sisulizer (a localization tool) but it doesnt work with Asp.net Controls properly.

View 4 Replies

DataSource Controls :: DropDownList With Static And Dynamic Data?

Jan 8, 2010

I have several dropdownlists which are databound to a SQL DB but I am also needing to add 2 items to them. I am using the code below.

With the code in the Calendar1_SelectionChanged sub (Which is when I want it to fire) It loads the data from the sql but not the static content

If I move the code to the Page_Load sub and add "If Page.IsPostBack Then" then it loads the static content but not the SQL.

[Code]....

View 5 Replies

Forms Data Controls :: Getting Values From A Dynamic Dropdownlist?

Jan 25, 2011

i have created a dynamic dropdownlist. i need to get the selected values from the list and store it in my sql database. i am new to asp.

View 5 Replies

MVC 2 Relation Without Foreign Key With Entity Framework 4 Or With Foreign Key?

Sep 13, 2010

1 - Is it necessary to have foreign key to obtain a Relation in Entity Framework between each entity.?
2 - I have a Language Table and many many table with a foreign key related to the language table. Is it right to add this foreign key or I should do something else ?
Ex:
Language
LangID
LangName

TableTextA
TblAID
TextInfo
LangID

TableTextB
TblBID
TextInfo
LangID

TableTextC
TblCID
TextInfo
LangID
etc ...

View 1 Replies

Forms Data Controls :: DropDownList With Dynamic Datasource In EditItemTemplate In Gridview?

Mar 2, 2011

I have two embedded dropdown lists in Gridview control. One gives you business channel options and the other represents products depending on the business channel selected.I am trying to use different data sources for product dropdown list depeding on what the user selected from the business channel drop down list. How could I do this. Here is my current code:

[Code]....

View 2 Replies

Forms Data Controls :: Unable To Get Dynamic Generated Dropdownlist Item

Sep 22, 2010

i'm using asp.net 3.5 and what im trying to do is create the dropdownlist item dynamically base on value in each datarow, then user select from dropdownlist and click button to postback, when postback system should be able to know what value has been selected by user. the problem with following code is during postback, event of "OnItem_Created" get fired and e.Item.DataItem return null, therefore the dropdownlist will not get populated with the items and that caused the dropdownlist unable to return value selected by user. am i missing anything? is "OnItemCreated" the best place to dynamic create the dropdownlist item?

[Code]....

View 2 Replies

Data Controls :: Add Dynamic Rows With TextBox And DropDownList In GridView Control

Sep 11, 2013

I want to add inputs from textboxes, ddl to datagridview without saving it to database by clicking on add button as many rows i want and later save it to database when clicked on save button....

View 1 Replies

Data Controls :: Sort GridView Using Dynamic Field Values From DropDownList

Mar 14, 2013

I have a gridview which is having coloumns Company name, Industry type, country, employees, revenue. i want to add dropdown at the top of each coloumn so that if user select industry as agriculture, all agriculture industry rows may be sorted, and same for other dropdown also.. i it may be possible,

View 1 Replies

AJAX :: Dynamic Data - DropDownList Field Template With Cascading DropDown Extension?

Sep 10, 2010

Have spent hours trying to create a Dynamic Data Field Template holding a DropDownList which is extended by the AJAX Cascading DropDown extension.Final form holds multiple cascading dropdown boxes. User selects Country (Land) then Postcodes, Counties (Provincie) are populated. Once postcode is selected then towns (Plaats) are populated. The problem I am now facing is that the viewstate for the dropdown lists is not being saved/restored after an insert action or custom validation error. So basically the dropdown lists are being reset to their default values.Some code (if missing parts, just ask and I will post them) - Don't mind the code structures etc... needs some refactoring :)Attribute I created:

[Code]....

KlantMetaData (=> Klant is Dutch for Customer ):

[Code]....

DynamicDropDownList Control I created:
[Code]....

Dynamic FieldTemplate created for inserts:
[Code]....

EntityTemplate I created:
[Code]....

Webservice methods created:
[Code]....

Code in masterpage:
[Code]....

View 1 Replies

Forms Data Controls :: ListView Dropdownlist Dynamic Select Command On Insert?

Jul 6, 2010

I would like to know if I can do the following: when I am in insert mode, can I dynamically change the select command of and then display that result in the second dropdownlist based on what was selected in the first dropdownlist.

I would like to include the minimum code to demonstrate what I am trying to do.

[Code]....

[Code]....

View 4 Replies

AJAX :: Dispalying Infowindow As In Google Maps On Selection Of Dropdownlist Dynamic Data In It?

Mar 6, 2011

like to display infowindow as it is in google maps on selection of Dropdownlist with data dynamically binded using VB.net can anybody provide me the code.

View 1 Replies

How To Convert Static HTML Website In To Dynamic Website

Jan 28, 2011

i have a website, which i have designed almost 3 months ago. it is totally html site and no database is used. basically it is a site having PDF books on it. i have more then 300 books on my website. but now i want to change my website into dynamic asp.net, so that i can easily handle my data of over 300 books. is there any tool available to convert the site? or i have to make the site from start?

View 9 Replies

How To Hide Some Fields On Insert And Edit Pages In Dynamic Data Website

Nov 30, 2010

I want to hide some fields, so that the user can't put value for them on insert and edit pages, and I will give these fields default values on code behind later.

I want to hide these fields just in insert pages but want to see them on the list pages, such as the createdAt column.

View 1 Replies

Forms Data Controls :: On Dynamic Control The DropDownList SelectedIndexChanged Event Fires Several Times?

Aug 4, 2010

I ask for a date, on OnTextChanged event i bind data with a SqlDataSource to a dropdownlist and also bind data to a repeater passing the dropdownlist SelectedIndex (i use SqlDataSource too and ControlParameter to link the dropdownlist and the repeater) On my repeater during the ItemDataBound event i create dynamic dropdownlist controls, my code is :

[Code]....

[Code]....

On the Page_load event of my page i bind the data & recreate the control :

[Code]....

Everything works fine, datas are bound and SelectedIndexes are restore on every postback.

The probem occurs when user change different dropdownlists, if he choose to change the 1st dropdownlist the event is fire (normal), after if he modifies another dropdownlist the event is fire twice, if he modifies a 3rd time the event is fire 3 time etc...

View 18 Replies

Dynamic Data Website Using Ado.net Entity Framework And Mysql Giving An Error Just On The Server?

Oct 3, 2010

I have an asp.net dynamic data website .net 3.5 built on ado.net entity framework with mysql database.Currently I have just one table in my entity model.

Everything is working fine on my local machine but when i uploaded on my server i got this error message:

"More than one item in the metadata collection match the identity 'mtDBModelStoreContainer'"

Note that this error happen when i open the table "WebsiteAdmin/users/List.aspx"

View 2 Replies

Forms Data Controls :: Dynamic Gridview With Dropdownlist / Dynamically Set The List Values Based On Parameters (of The Row They Are On)

May 28, 2010

I'm new to web dev and c# so please bare with me. I am trying to create a dynamic gridview in a web form for users to to answer questions with (code below).

The dificulty im having is that i am nesting a dropdwonlist in the gridview and want to be able to dynamically set the list values based on parameters (of the row they are on). These values are in the main dataset for the gridview as each row represents a questionid and question text and then a ddl for the criteria...

I just don't know how to set the values for the dropdown all the code so far is below... just need to be able to populate the dropdowns with the relevant values.

I have created a stored proc to return the different criteria based on the questionid and questionGroupid which is the dataset that populates the other fields in the gridview: dbo.usp_QuestionCriteria @QuestionGroupId, @QuestionId

I have added this as a tableadapter called criteriaTableAdapter in a xsd file as well using the wizard... not sure if this is the right option though or just use the same method as i have for the other stored procedure as in the code below:

[CODE

]using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Sql"].ConnectionString);
con.Open();
SqlCommand com = new SqlCommand("usp_QuestionGroupDS", con);
com.CommandType = CommandType.StoredProcedure;
SqlDataAdapter ada = new SqlDataAdapter(com);
DataSet ds = new DataSet();
ada.Fill(ds);
for (int i = 0; i < ds.Tables.Count; i++)
{
if (ds.Tables[i].Rows.Count > 0)
{
GridView gvDynamicQuestion = new GridView();
gvDynamicQuestion.Width = Unit.Pixel(700);
gvDynamicQuestion.BorderWidth = Unit.Pixel(0);
gvDynamicQuestion.Caption = "<div id="nifty" class="QuestionGroup"> <b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>" + ds.Tables[i].Rows[0]["Category"].ToString() + " Questions<b class="rbottom"><b
class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b></div>";
gvDynamicQuestion.AutoGenerateColumns = false;
gvDynamicQuestion.ShowFooter = true;
TemplateField tf = null;
tf = new TemplateField();
tf.HeaderTemplate = new DynamicGridViewTextTemplate("QuestionId", DataControlRowType.Header);
tf.ItemTemplate = new DynamicGridViewTextTemplate("QuestionId", DataControlRowType.DataRow);
tf.FooterTemplate = new DynamicGridViewTextTemplate(DataControlRowType.Footer, ds.Tables[i].Rows.Count);
gvDynamicQuestion.Columns.Add(tf);
tf = new TemplateField();
tf.HeaderTemplate = new DynamicGridViewTextTemplate("Question", DataControlRowType.Header);
tf.ItemTemplate = new DynamicGridViewTextTemplate("Question", DataControlRowType.DataRow);
gvDynamicQuestion.Columns.Add(tf);
tf = new TemplateField();
tf.HeaderText = "Criteria";
tf.HeaderTemplate = new DynamicGridViewTextTemplate("Criteria", DataControlRowType.Header);
tf.ItemTemplate = new DynamicGridViewDDLTemplate();
gvDynamicQuestion.Columns.Add(tf);
////tf = new TemplateField();
////tf.HeaderText = "Criteria";
////tf.ItemTemplate = new DynamicGridViewDDLTemplate();
////gvDynamicQuestion.Columns.Add(tf);
gvDynamicQuestion.DataSource = ds.Tables[i];
gvDynamicQuestion.DataBind();
phDynamicGridHolder.Controls.Add(gvDynamicQuestion);
}
}
}
protected void DynamicGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Footer)
{
//
}
}
}
public class DynamicGridViewTextTemplate : ITemplate
{
string _ColName;
DataControlRowType _rowType;
int _Count;
public DynamicGridViewTextTemplate(string ColName, DataControlRowType RowType)
{
_ColName = ColName;
_rowType = RowType;
}
public DynamicGridViewTextTemplate(DataControlRowType RowType, int QuestionCount)
{
_rowType = RowType;
_Count = QuestionCount;
}
public void InstantiateIn(System.Web.UI.Control container)
{
switch (_rowType)
{
case DataControlRowType.Header:
Literal lc = new Literal();
lc.Text = "<b>" + _ColName + "</b>";
container.Controls.Add(lc);
break;
case DataControlRowType.DataRow:
Label lbl = new Label();
lbl.DataBinding += new EventHandler(this.lbl_DataBind);
container.Controls.Add(lbl);
break;
case DataControlRowType.Footer:
Literal flc = new Literal();
flc.Text = "<b>Total No of Questions:" + _Count + "</b>";
container.Controls.Add(flc);
break;
default:
break;
}
}
private void lbl_DataBind(Object sender, EventArgs e)
{
Label lbl = (Label)sender;
GridViewRow row = (GridViewRow)lbl.NamingContainer;
lbl.Text =DataBinder.Eval(row.DataItem, _ColName).ToString();
}
}
public class DynamicGridViewDDLTemplate : ITemplate
{
// Implementation of ITemplate
public void InstantiateIn(System.Web.UI.Control container)
{
// Create a DDL
DropDownList ddl = new DropDownList();
//Attach method to delegate
ddl.DataBinding += new System.EventHandler(this.ddl_DataBind);
container.Controls.Add(ddl);
}
//Method that responds to the DataBinding event
private void ddl_DataBind(object sender, System.EventArgs e)
{
//DropDownList ddl = (DropDownList)sender;
//DataGridItem container = (DataGridItem)ddl.NamingContainer;
//ddl.Data.Checked = [Data binding expression];
}
}

[/CODE]

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved