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

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

Insert Parameters on a form View

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

Hi All

Are they any special Insert Paramters I shoud/need to use on a formView.  I currently have the below datasource but when submitted it only inserts <NULLS> intot he required table.

 <asp:SqlDataSource ID="addChangeDataStore" 
                                   ConnectionString="<%$ ConnectionStrings:LocalSQLServer %>"
                                   InsertCommand="INSERT INTO tblChanges(NINumber, TitleIDNo, Forename, Surname, ContractPostNumber, PayRef, DateofChange, TypeofChange, UserID, EmployerIDNo, FurtherInfo) VALUES (@NINO, @TitleIDNo, @Forenames, @Surname, @ContractPostNumber, @PayRef, @DateofChange, @TypeofChange, @UserID, @EmployerIDno, @FurtherInfo)" 
                                   SelectCommand="SELECT tblChanges.* FROM tblChanges">  
                                        <asp:Parameter Name="Nino" Type="String" ConvertEmptyStringToNull="true" /> 
                                        <asp:Parameter Name="TitleIDNo"  Type="String"  ConvertEmptyStringToNull="true" />

View Complete Post

More Related Resource Links

Form View: Filtering Drop down on insert using objectdatasource



I have a grid view which display different phone types with insert,edit and delete options.

During insert in the modal formview I have dropdown for different phone types which is bound to an
object datasource. The object datasource displays all the available phone types including the ones
displayed in the gridview

How do I display only the values that is not in the gridview. I tried setting the object datasource to a different one
and it does not work ( in Item created event). It display no values in the dropdown when I know there is more than 1 availble.

How do I change the object datasource during insert or how do I filter the values in the dropdown.




protected void FormViewOnlinePhone_ItemCreated(object sender, EventArgs e)
         FormView fvPhone = (FormView)FindControl("FormViewOnlinePhone");

         DropDownList dropdownUsage = (DropDownList)fvPhone.FindControl("DropDownListPhoneType");
         DataSet dsType = new DataSet();
         if (FormViewOnlinePhone.CurrentMode == FormViewMode.Insert)
            dsType = psClass.GetInsertPhoneTypes(application_id);
              dropdownUsage.DataSource = dsType.Tables["usage"];

Data View: Cannot insert new item form


Hello there,


I'm wrestling with the problem of creating a website form by which it should be possible to submit data to a sharepoint list.

I have gone to the root of my site collection where I have created a new custom list, added all the custom columns I would like and added some dummy content (two rows). 

Now I want create a form in which my frontend users (anonymous) can create new rows to the list. It's a conference registration list where the customers should be able to register for the next conference.

I would like full control over the layout of the form and integrate it seamlessly with the rest of my site design.

Guided by this video I have tried to create a such form: http://www.youtube.com/watch?v=yHtzKsOwqqQ&feature=related

The problem is this: when I have inserted the data view into the webpart zone, chosen my prefered list and chosen the fields I would like to be contained by the form and press the "insert selected fields as... " button the possibility of "new item form" is not available. Why is that so? This seems to be the right thing to do.

Problems with the permissions? I have set anonymous users to be able to create new list items for the relevant list. 

Note: When I proceed the same way in the list-folder and for example open the "newForm.as

view state vs request parameters


If  the view state is the data entered into the form fields then they are supposed to be available in the request parameters or request body. Then why would we need view state for?


Form view in ASP.NET


hi all...!
i have a database and i create a form with button edit,delete, New Registration..using Formview in asp.net..
everything was working good...

And i write SQL statement to get New ID number into dropdownlist/TextBox when i click button "New Registration".

i can get new(next) ID number after read database
it's also working good

Now i want change it to get ID which was deleted from table and replace the ID with new record...what i need is when i click "New Registration" i want get deleted "ID" first and then go to new record ID...

my code is here:-it working for get next ID after read database.

FROM Table1
AS boon WHERE PANG &gt;300000

Insert image into Infopath form and save to SharePoint as PDF file


I have an InfoPath web-enabled form in MOSS 2007, that is integrated with a K2 blackpoint process for an approval workflow.

Once the form (a Purchase Order request form) has been approved in the K2 workflow process, I switch the form view to a "print-friendly" view for the requestor to view from the browser.  However, now I need to go one step further with this scenario:

1) I need to somehow insert/embed an image with the scanned-in signature of the approver (likely stored in a SP doc library) at the signature line section of my form.  Also, what are the security requirements for storing such images, but not granting all users access to these (e.g. only services accounts that need to access this for embedding into the form, etc.)?

2) Then I need to convert this final "print-friendly" view of the form (with the signature image) to a PDF document so that I can store it in SharePoint (and email it to the requestor using K2's email event capabilities).

Can anyone help me with a solution to both of these requirement, or point me to some resources for this (even 3rd party components are open-game).



Infopath 2007 print view in browser enabled form with Print button


Hi i create a  print view brower enabled form in Infopath 2007 with header and footer. In Infopath works fine. Margin was ok, header and footter to. But then i try to print this browser the margin, header and footer it changes to default setting of browser ? I try also create a print button in form with VS 2008 code, but method :

this.print(); not working.

It is possible to print the "print view" in browser as the same like in Infopath 2007? Does anyone have the code how to create a print button in C# on browser enabled form?

Issue in Infopath 2007 browser form - cascading dropdown using owssvr.dll filter view


Referring the below link, I created a cascading dropdown. The parent dropdown has sharepoint list as datasource and the child dropdown has xml datasource that points to owssvr.dll filter view. The cascading drop down works fine in preview but throws error after publishing as admin approved form - "form cannot run the specified query" exception when trying to execute xml datasource i.e., when a value is selected in parent dropdown. The security is 'Full Trust". In the event viewer the error message states "401 unauthorised" for the user a/c. the xml data source is an approved udcx file and in central admin, have enabled cross domain for infopath service. I have tried different solution provided in tech forums but issue still exists. Not sure whether Im missing something. Can someone guide me in fixing this issue?

Link Reffered:



Form Action Button to pass parameters through URL and how to fill a NewForm with them

Hi I'm trying to solve a bigger problem we have in babysteps, and I guess after days of searching and trying I simply need to ask for help. The big picture is, that we're trying to put a Form Action Button (via Sharepoint Designer 2007) above a custom DataForm DispForm.aspx which is supposed to navigate to a NewForm.aspx where the Title Field is supposed to be prefilled with a parameter from the DispForm and the user should be able to add information to the item before it is saved. I found several explanations from people on the internet, but nothing really worked. The first babystep would be to get the parameter through the button into the url of the new item.   < input type = "button" value = "Zugriff Beantragen" name = "btnFormAction0" onclick = "javascript: {ddwrt:GenFireServerEvent('__redirect={../Zugriff Beantragen 2/NewForm2.aspx?test={ItemID}')}" />   That's the code for my button. Somebody wrote that should definitely work because SharePoint is able to replace {ItemID} with the actual ID of the item. Well.... it kind of doesn't. What I get as the end of the new URL is exactly "...?test={ItemID}"   I tried with different names for the ID, I added an @ before those ... no change. I read somewhere about javascript.functionName() which should work with all parameters of the item, but

Passing return value from a Web Service to a label in a Form View

I am using JavaScript to call a web service. The JS is correctly receiving and passing the web service information. At the moment, the web service returns a country name as a string to a JavaScript alert pop up box as follows:ret = CountryRegionsWebService.GetTranslatedCountryShortName(ddl1_value, ddl2_value, OnComplete, OnTimeOut, OnError);function OnComplete(args) { alert(args); } I want to change this so that web service returns the country name to a label inside an insert item template of a form view. Is there a way to pass in the label variable to the OnComplete function signature and still account for the variable args?, such as: Server Side Declaration of JavaScript ddl2.Attributes.Add("onChange", "JavaScript:OnComplete('" + lab5.ClientID + "', '" + "args" + "');"); Client Side JavaScript function OnComplete(lab5_id, args) { var lab5 = document.getElementById(lab5_id); lab5.innerHTML = args; }  

making page work after DB update in Form View

I could really use some help with this issue. I have a DropDown that allows the selection of a Category Code. The selection populates a Gridview with details of records matching the Category Code. I have only enabled the Select option on the Gridview, which when clicked populates a Formview in Edit Mode with the full record information. When editing is complete and the Update link is clicked, I can not get the page to properly reload/postback. When another Category Code is selected from the Drop Down the Gridview does not report a list of records.   Any help would be greatly appreciated.   Thanks,              

How to pass page column value to data view parameters

Hi All, I have a page library with custom column, lets call it "FormCourseId". On that page I have data view which retrieves data from custom list filtered by page column "FormCourseId". In parameter wizard creates the following tag <ParameterBinding Name="ListCourseId" Location="Form(FormCourseId)" DefaultValue=""/> Then I try to use that parameter in XSLT of data view as a filter creteria.  <xsl:param name="CourseId"></xsl:param> It does not work for me. If I change data view parameter source from Form to Query String and pass parameter as url one it works fine. What is wrong with page column parameter binding? May be if FormCourseId column is not presented in form layout as a field(I do not need to show that field in user form of the page) it could not be treated as form parameter?

Filter Infopath Form View issue

Hi every body I want to Filter Infopath Form view based on the Document Library Name , or url . for example i have two document library : users and Moderators . I need if user open the form in users document library , the form opens with Users View and if user opens the form in Moderators document lib the form open with the Moderator view . what should i do ? I tried to insert a text box in my form and set it's default value to use sharepointlisturl function. but i think the sharepointlisturl function only use when the form hosted from the lists , not document libraries. when my form hosted from document library the text box is empty. i don't know what to do !

Web Part on View Form Hides Ribbon

If I add a web part to a list or document library view for - say 'AllItems.aspx', the 'Library Tools' ribbon section is hidden.  Is this intended behavior or is there some configuration setting I am missing? To reproduce: Create a new Document Library Edit the default 'AllItems.aspx' view page Add a web part (any WP seems to do it) Exit edit mode Only the 'Browse' tab is now available

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?

updated view (with insert )on two tables

CREATE TABLE [tbl1](       [ID] [int] IDENTITY(1,1) NOT NULL,       [F1] [int] NULL,  CONSTRAINT [PK_tbl1] PRIMARY KEY CLUSTERED (       [ID] ASC ) ) ON [PRIMARY] GO CREATE TABLE [tbl2](       [ID] [int] NOT NULL,       [f2] [int] NULL,  CONSTRAINT [PK_tbl2] PRIMARY KEY CLUSTERED (       [ID] ASC ) ) ON [PRIMARY] GO CREATE VIEW [View_1] AS SELECT     tbl1.ID, tbl1.F1, tbl2.f2 FROM         tbl1 LEFT OUTER JOIN                       tbl2 ON tbl1.ID = tbl2.ID GO INSERT INTO [BackUpsData].[dbo].[View_1]            ([F1],[f2])      VALUES(1,1) i get this message : Msg 4405, Level 16, State 1, Line 1 View or function 'View_1' is not updatable because the modification affects multiple base tables.   how can i create a view that can insert new rows into ? thanks.  

accessing form view binded control from child control

I am using a form view control which has two binded textbox. Now at this level it works fine and the textboxes show the values from database. But when i insert a panel inside the form view and move these two textboxes inside the panel, they dont show any values. What could be the reason for this? Thanks!

save codes error in form view tool

hi i use this code in form view(at INSERT button)  for save data into SQL serverInsertCommand="INSERT INTO Debtor (AccNo, CompanyName, Desc2, RegisterNo, Address1, Address2, Address3, Address4, PostCode, AreaCode, Phone1, Phone2, Fax1, Fax2, NatureOfBusiness, WebURL, EmailAddress, DeliverAddr1, DeliverAddr2, DeliverAddr3, DeliverAddr4, DeliverPostcode, Attention, SalesAgent, DebtorType, DisplayTerm, CreditLimit, CurrencyCode, UDF_Shipvia, UDF_freigh, UDF_SourceIn, UDF_ProductEnq)VALUES ( @AccNo, @CompanyName, @Desc2, @RegisterNo, @Address1, @Address2, @Address3, @Address4, @PostCode, @AreaCode, @Phone1, @Phone2, @Fax1, @Fax2, @NatureOfBusiness, @WebURL, @EmailAddress, @DeliverAddr1, @DeliverAddr2, @DeliverAddr3, @DeliverAddr4, @DeliverPostcode, @Attention, @SalesAgent, @DebtorType, @DisplayTerm, @CreditLimit, @CurrencyCode, @UDF_Shipvia, @UDF_freigh, @UDF_SourceIn, @UDF_ProductEnq)"> it's show error at:-        Must declare the scalar variable "@AccNo".if i run the application without add (AccNo,....)VALUES(@AccNo) into above codes it's working good..AccNo is into drop down list control..
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