I'm new to infragistics. I have a database and a datalayer with entity framework and linq. Now I want to get the data to an Infragisticscontrol, let's use a UltraCombo. I have not problem to bind the data to the control. My problem is that all properties from the linqquery is displayed.
As far as I can see there are two options
1) Create a data schema manually. In this way there is much effort put in creating the schema and when I refactor something then the schemas of all controls must be updated.
2) Creating a data schema automatically.
I played a bit with the secand case but can'T find an option how to create the data schema automatically but binding the data manually. I had one case where I bound it to a model of the entity framework and deleted the datasource later from the project. In this case it worked but I don't think that this is the right way to use it.
Can somebody tell me how to do this or what's the best practice?
I found a solution in the Infragistics forum below. Here's the link: http://blogs.infragistics.com/forums/p/24379/89509.aspx
Related
I have an Stored Procedure which may return some unpredictable rows and columns, based on some business logic written in my SP. That is for sure that it will return only one set of Result Set data from this SP.
Whatever the result my SP returns, it should be reflected into my GridView. Due to some framework restrictions, I can not use ADO.Net DataSets/DataTables.
I am using Entity Framework 4.0 for my project and I want some solution to bind my GridView with dynamic nature of DataSource returned by my Stored procedure.
I think, this is very common problem which many developer has encountered in such type of situation.
Is there anyone who have found some work around to achieve the goal within the boundary line of Entity Framework?
Note: Keep in mind that, I don't want to use ADO.net DataSet or DataTable.
I think you are fetching data from proc and stored in List like that.
List<HRDocumentCheckList> searchJoiningDoc = GetJoiningDocumentForEdit(ddlCategory.SelectedValue.ToInt32(), false).ToList();
gvJoiningDocumentTemplate.DataSource = searchJoiningDoc;
gvJoiningDocumentTemplate.DataBind();
Just bind the gridview and set the autogenrated column is false
Hope it will helps you
I have a table in another database I would like to scaffold via ASP.NET Dynamic Data and incorporate into my existing Entity Model - is there anyway to do this? (eg using a view or other mechanism or customize the view, edit or insert operations via ad-hoc SQL or stored procedures?)
I don't want to replicate the entire DynamicData sub-folder structure and create another entity model for just one table
I was able to solve this by manually creating an entity in the SSDL and CSDL sections of the .edmx file by using a DefiningQuery and then defining the EntitySets for my entity class
I also added insert / update / delete Function elements to the SSDL with inline SQL using the CommandText property
At this point I had enough to let the Designer map the CRUD methods to these inline SQL functions I defined
It's a little tricky but it works and the general approach opens up many possibilities I had not thought about
I have the following scenario:
My website db has a system table called "Companies", which includes an id field, companyName field, and companyImageUrl field.
How do I set up an umbraco document type for adding entries to this table ?
Maybe I shouldn't use a custom table at all ?
Thanks.
As far as I know, Umbraco doesn't support what you want to do out of the box (mapping a document type to a table that isn't part of the umbraco core).
One approach that might work is to create an action handler that syncs a Company doc type to your table when creating a node of that type.
It's a bit of a hack though. I've found that I've very rarely needed to create custom tables. What exactly are you trying to do with it? My guess is that you don't really need it and would be better off working with a doc type instead. Umbraco provides a variety of ways to get and act upon doc types from within custom C# code (check out the umbraco.NodeFactory namespace). You'll also get the added benefit of being able to easily interact with these nodes from XSLT/Razor.
Is it possible to add properties to my model that dont exist in the database?
For example I have a calendar table, I want to retireve this data in my MVC controller then work out time left until each entry starts and return this to the view. So I would like another property in my calendar model to hold time left which is a value that I will generate outside of the database.
I've tried just adding the property but when I do that I get errors because the property is not mapped to anything.
Is this even possible?
Thanks
You should be able to add the property to the Model but you will not be able to query it with LINQ. LINQ will ultimately build and expression which it will want to run against the database using SQL. Its at that point that your LINQ will fail to find a mapping from your property to a field somewhere.
If your query returns an IEnumerable of the actual type on which you have created the property your view may be able to access it. I can't remember if EF insists on mapping in that case, it may do.
You might find that you can create subsequent LINQ query that uses LINQ-to-objects if you want to provide some other composite type to your view.
It's a non-persistent property or transient. I don't know Entity Framwork well but with a quick google search you should find the answer.
BTW you can find a lot of tips here :
http://weblogs.asp.net/zeeshanhirani/archive/2008/12/18/my-christmas-present-to-the-entity-framework-community.aspx
After making a quick search myself and a test in VS2008 I don't see a way to exclude a property from the mapping. Maybe it requires you to edit manually the mapping file ? :(
I recently began working on a project which has many gridviews on a single page. During creation of a new record, the user needs to be able to add/remove/edit these gridviews and then save to the database at the end. The problem with this obviously is that there is no datasource to bind the data too until after its written to the database.
This data represents a 1..* relationship, which is why the gridview data cannot be written to the database until the parent record has been created first.
The best way I have found so far to solve this is to use viewstate. This solution however does not seem ideal to me. I am also forced to manually create the gridview functionality with OnDeleting, OnUpdating, etc so that I can manage the binding of the viewstate with the gridview.
Does anyone have any suggestions on a better way to manage this situation, it seems like it would be a common thing?
UPDATE:
Keep in mind this data needs to be around throughout postbacks.
Use a DataSet as an intermediate connection to your data source. Fill the DataSet with your data and then bind your GridView to the DataSet setting the GridView DataMember to the name of the table it is supposed to bind to.
As the user updates tables it will add/modify records in the DataTables in the DataSet. When the user is done editing and clicks "Save" your code can then update the database from the datasets, either automatically using a DataAdapter, or manually looking at the RowState of the rows in the DataTables.
Use a DataAdapter and a Dataset. Invoke the fillschema method in the adapter to create de metadata (cols, constraints, relations, etc) in the dataset. bind the data tables created to the different grid views. update manually cheking each row rowstate on each table or call the adapter's update method to do it automatically. If you do it automatically you need to define commands for insert, delete, and update in the adapter.