.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to form fields without strongly typing model?

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :ASP.Net

I am facing few issues. I am using MVC2.

I am developing a form which is being created dynamically based on its layout and all html attributes info stored in DB table. This dynamically generated form stores data(this table have all html field names as columns) in another db table(db is mysql).

I have created ViewModel class in which i get both design table entity objects and data table entity object. I, then, created strongly typed view based on that ViewModel. But the problem is when i rendering html fields using html helpers i.e TextBox(Model.tblDesign.htmlField_name). it doesnt bind with the columns of Model.tblData whose names are same as of Model.tblDesign.htmlField_name.

Please help me how can i bind fields of data table?

View Complete Post

More Related Resource Links

Send an Email with User fields data entered in the form


Hi All,

          I have a form which have some user input fields(like textboxes,dropdownlists,textarea etc) fields and a submit button.

on click i need to send email with body contents as all the details entered by user in the form

Can anyone suggest how i should approach to this in sharepoint..

any code examples would be appreciated.


error in MVC2 on empty string form fields which are required: "This property cannot be set to a null

In model I have:[DisplayName("ISBN")] [Required(ErrorMessage = "ISBN is required.")] [StringLength(50, ErrorMessage = "ISBN book must have max {1} chars.")] [DisplayFormat(ConvertEmptyStringToNull = false)] public string isbn { get; set; }But when I submit form with empty field ISBN I have an error - ConstraintException: This property cannot be set to a null value.I have find that other people have the same problem and they say that debbugger in VS2010 works wrong - yes ?http://p2p.wrox.com/book-professional-asp-net-mvc-2/79788-constraintexception-unhandled-user-code.html#post259245http://efreedom.com/Question/1-3129080/Server-Side-Validation-REQUIRED-String-Property-MVC2-Entity-Framework-Workhttp://mvcmusicstore.codeplex.com/workitem/6604

Changing fields while updating an InfoPath Form to a SharePoint 2010 Document library

My document library has following EventReceiver: <?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Receivers ListTemplateId="101"> <Receiver> <Name>EventReceiverDocumentLibraryItemUpdating</Name> <Type>ItemUpdating</Type> <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly> <Class>EventHandling.EventReceiverDocumentLibrary</Class> <SequenceNumber>10000</SequenceNumber> </Receiver> </Receivers> </Elements> Updating a browser enabled InfoPath form in the document library fires following event: Public Overrides Sub ItemUpdated(ByVal properties As SPItemEventProperties) Try Me.EventFiringEnabled = False properties.ListItem("Lastname") = "Testperson" properties.ListItem.ParentList.ParentWeb.AllowUnsafeUpdates = True properties.ListItem.SystemUpdate(False) ' solution 1 properties.ListItem.Update() ' solution 2 properties.ListItem.UpdateOverwriteVersion() ' solution 3 properties.ListItem.ParentList.ParentWeb.AllowUnsafeUpdates = False Me.EventFiringEnabled = True MyBase.ItemUpdated(properties) Catch ex As Exception Me.EventFiringEnabled = True E

namespace of fields problem when creating form template from xml?

I created a form template from a predefined xml, where I do not have any namespace. Later I added more fields. The output xml of the form is for the fields from the xml they have not prefix, for those added later, they have prefix my. I already have them all done. How can I make them consistent to have prefix my? Is there any options in InfoPath to turn on or off the prefix my?   thanks,

Using UserName to enable disable access to InfoPath form fields

Hi Everyone, I have created a browser enable form in InfoPath and restrict certain fields depending on the official logged on User Name. Now this works most of the time but my problem has to do with the "case" of User Names for some of the site users. In most cases the User Name is an exact match but for some reason, some user's names are reported by SharePoint (the Welcome at top of screen) with some parts captilized. Example - my hidden filed on the form reports my user name as xrs_master but the Welcome up top says XRS_Master - and the fields act as though I am not the correct user and won't enable. On the other hand there are users who's user name matches the case exactly and all works fine. Why is SharePoint reporting the user name differently? And if this is the reason they don't match, how do I fix it? Any Ideas? Many thanks in advance for help!

How to submit my form to Sharepoint Library as well as Sharepoint List with specific Fields only.

Hello ,   I have a Infopath form that contain 50 of fields. i want to submit those form into sharepoint library as well as Sharepoint Custom List(Specific Fields). Please suggest best practice to develop such a functionality.   Thank you.

Print Form View and expanding text fields?

The form i'm editing has a small text field with a scroll bar that users enter quite a bit of data.  I'm wondering how to create a print view for the form that will expand that field to match the size of the content text. Does that make sense?

Get ID's of reference fields with sharepoint .net object model?

Greetings. My overall goal is to bulk copy sharepoint (moss2007) site's lists into sql database (to later query them etc). I gave up trying to use web services sharepoint offers because Query() service does not return ID's of fields that are actually referencing something (like users) and GetListItems only returns limited amount of rows and does not provide a schema, means that for russian sharepoint, all column names are total rubbish and there is no way (programmatically, from web service reply) to know which one is which actual column. Right now i am trying to write a web service that will return all kind of stuff i need - schema of the list, and rows of the list. In rows, i need to return ID's of the fields where the field is a reference kind, like User, because, we have serious sized lists (>20000 items grown in less than a year) and we cannot afford truncate/insert, we need to only query for changes and insert/update them. So, if i store for ex. username (not domain name but full name) as string, and user changes his surname, it wont get updated and queries would fail. I need to store an ID. I currently use this code sample:   string const_sitelink = "http://moss2k7-2/sites/test/"; SPSite testsite = new SPSite(const_sitelink); SPWeb testweb = testsite.AllWebs[""]; SPList list =testweb.GetList("/sites/test/Lists/List1&q

delete workflow fields in a form

Hi I was testing a few workflows in a document library..after settling for the final workflow, I deleted the other workflows, however..the field still appears when I view the document library...How can i get rid of these fields, I know I can uncheck them from the view, but I want to delete this fields.

strongly typed view - Complex Model

I have a class ProjectDetailModelView with       ProjctDetail (fields to display)        UserList - SelectList (for dropdown control)I pass in  Inherits="System.Web.Mvc.ViewPage<glossaryDB.Manager.ProjectDetailModelView>" %>       And I want to use something like the following:<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">    <h2>Project : Edit</h2>     <% Html.EnableClientValidation(); %>    <% using (Html.BeginForm()) { %>        <fieldset style="padding: 1em; margin: 0; border: solid 1px #999;">            <%= Html.ValidationSummary("Broken stuff:") %>               <%= Html.EditorForModel() %>            <input type="submit" value="  Submit  " />   

how to open a subform model Form,Sub Window form using jquery that save the data ajex

how to open a subform model Form,Sub Window  form using jquery that save the data ajex

how to duplicate fields on form data source?

I have many fields with similar names and same type. Is there any easy to copy and paste and then change field names? thanks,

Silverlight Client Object Model - List Fields Names


I'm trying to get the DisplayName of the Fields of a list through the Client Object Model (Silverlight)

I can retrieve the fields of a list as an authenticated user but not as anonymous: getting list.fields as anonymous simply returns Access Denied.

Is there a way to enable list.fields for the Client Object Model?

Or is there any other way of getting the DisplayName of Fields of a List?

Setting SharePoint 2010 Form Fields Using Query String Variables


Hi All,

I have a requirement to populate sharepoint form field value with query string while uploading document to document library.

While uploading the document to document library, I want to populate claim number available from query string in a pop up page i.e in my case EditForm.aspx, Located at http://servername:port/sitename/documentlibraryname/forms/EditForm.aspx.

Additional Information:

  • Created document library and added custom columns like claim number etc..
  • Created a view to filter uploaded documents as per claim number.

Server Details:

  • Windows Server 2008 R2
  • SharePoint 2010
  • SQL Server 2008 R2

I have written javascript for the same, but not sure where exactly to add the code in EditForm.aspx page.

Any help on this would be greatly appreciated.

Thanking you in advacne.



Need help on Select button column in Data Grid to populate fields in Form View


 When I have a select a row in a Data Grid that when I click on it I want it to show the info for the person I selected in a form view on the same page as the Data Grid. Here are the columns for the Data Grid that I have set up, the column is highlighted:

<asp:DataGrid ID="MHGrid" AutoGenerateColumns="False"  
        DataSourceID="MHFoundation" DataKeyField="POPULATION_LIST_ID" 
        AllowPaging="True" AllowSorting="True" BorderStyle="Solid" 
        BorderColor="#999999" BorderWidth="3px" CellPadding="4" PageSize="4" 
        CellSpacing="2" runat="server" BackColor="Gray" Font-Bold="False" 
        Font-Italic="False" Font-Overline="False" Font-Strikeout="False" 
        <SelectedItemStyle BackColor="#FF9900" Font-Bold="False" Font-Italic="False" 
            Font-Overline="False" Font-Strikeout="False" Font-Underline="False" />
            <asp:ButtonColumn CommandName="Select"  Text="Select"></asp:ButtonColumn>
            <asp:BoundColumn D

Server Side Validation for SharePoint 2007 Form Fields


Hi Guys,

Need to validate NewForm.aspx and EditForm.aspx of SharePoint custom list. My current implementation is by using JavaScript. It's working fine.

Someone suggested JavaScript is not a good approach.I am unable to fetch ids dynamically by JavaScript only for few fields (people picker, calendar control) and in that case i have hard coded the ids. hardcoding is always a bad approache.

Is there any way to validate those mentioned form at server side? Is it really good way to think that my validation can put inside Event Handler?

thanksArup MCTS - SharePoint

Play Sudoku

Dynamically add more fields to form


I have seen it on here or while googling, but never had a need for it with any projects, now i have a form that has 32 fields, PLUS up to 32 other possible fields.. Not sure how to go about this.. i dont think that having a form with 64 fields is the best solution as you may just need the first 32, but here is my attempt to explain it.

I have a page which will gather configuration information, one of the things about this configuration is that you have a 1 to many relation with cameras.

So you have your set configuration for a location, but that location can have up to 32 possible cameras associated with it. But of course you may have just have one camara, so of course you would only need to add 1 new field..

Any suggestions or links to adding dynamic fields would be great.. the other thing is if fields are added dynamically, how to handle that in the insertign of the data into the database, since we wont know how many fields there will be until they hit the submit button.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend