-
This is slide 1 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words. -
This is slide 2 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words. -
This is slide 3 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words. -
This is slide 4 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words. -
This is slide 5 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.
Sep 3, 2008
Add Code in Infopath Form.
How we install VSTA.
- Go to Control Panel | add/remove programs | Change office 2007 | Click on add or remove Features
- Go to Microsoft infopath option |.net programability support | .net programability support from .net 2.0 version
- right click on visual studio tools for applications | run from my computer
- click on continue and VSTA has been install
How we write the Code
- Go to Tool Menu | Form option | programming | language
- select Security and trust option | Full trust and check the option of sign this form template |Certificate | OK.
- Go to Tools menu | programming |Microsoft visual studion tools application.
- Copy and Paste the Code.
using Microsoft.Office.InfoPath;
using System;
using System.Windows.Forms;
using System.Xml;
using System.Xml.XPath;
using mshtml;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
namespace Publicutilities
{
public partial class FormCode
{
//Make the object of webservices
Publicutilities.@in.disnic.services.PublicUtility_Services ObjService = new Publicutilities.@in.disnic.services.PublicUtility_Services();
// NOTE: The following procedure is required by Microsoft Office InfoPath.
// It can be modified using Microsoft Office InfoPath.
public void InternalStartup()
{
((ButtonEvent)EventManager.ControlEvents["btnSubmit"]).Clicked += new ClickedEventHandler(btnSubmit_Clicked);
EventManager.FormEvents.Submit += new SubmitEventHandler(FormEvents_Submit);
}
///
/// Method to Submit UserData in CategoryData Table;For submitting Data we have Used a [webMethod]
/// that will accept 3 parameters as Array Object as AvailabilityStatus,ObjectDistanceCode,Code.
public void btnSubmit_Clicked(object sender, ClickedEventArgs e)
{
// Write your code here.
int[] ObjectDistanceCode = new int[4];
XPathNavigator root = this.MainDataSource.CreateNavigator();
XPathNavigator field = root.SelectSingleNode("/my:myFields/my:CodeIH",
this.NamespaceManager);
if (field.Value != "")
ObjectDistanceCode[0] = Convert.ToInt16(field.Value);
XPathNavigator field2 = root.SelectSingleNode("/my:myFields/my:CodeNh",
this.NamespaceManager);
if (field2.Value != "")
ObjectDistanceCode[1] = Convert.ToInt16(field2.Value);
XPathNavigator field3 = root.SelectSingleNode("/my:myFields/my:CodeSh",
this.NamespaceManager);
if (field3.Value != "")
ObjectDistanceCode[2] = Convert.ToInt16(field3.Value);
XPathNavigator field4 = root.SelectSingleNode("/my:myFields/my:CodeMD",
this.NamespaceManager);
if (field4.Value != "")
ObjectDistanceCode[3] = Convert.ToInt16(field4.Value);
XPathNavigator field5 = root.SelectSingleNode("/my:myFields/my:CodeOD",
this.NamespaceManager);
//Define An Array to Store Avalability Status for CheckBoxes
int[] AvailabilityStatus = new int[4];
XPathNavigator Field1 = root.SelectSingleNode("/my:myFields/my:catIH",
this.NamespaceManager);
if (Field1.Value == "true")
AvailabilityStatus[0] = 1;
else
AvailabilityStatus[0] = 0;
XPathNavigator Field2 = root.SelectSingleNode("/my:myFields/my:CatNH",
this.NamespaceManager);
if (Field2.Value == "true")
AvailabilityStatus[1] = 1;
else
AvailabilityStatus[1] = 0;
XPathNavigator Field3 = root.SelectSingleNode("/my:myFields/my:CatSH",
this.NamespaceManager);
if (Field3.Value == "true")
AvailabilityStatus[2] = 1;
else
AvailabilityStatus[2] = 0;
XPathNavigator Field4 = root.SelectSingleNode("/my:myFields/my:CatMD",
this.NamespaceManager);
if (Field4.Value == "true")
AvailabilityStatus[3] = 1;
else
AvailabilityStatus[3] = 0;
//InsertDistanceData is a [web method] used to store user information.
ObjService.InsertDistanceData(ObjectDistanceCode, AvailabilityStatus);
}
public void FormEvents_Submit(object sender, SubmitEventArgs e)
{
// If the submit operation is successful, set
e.CancelableArgs.Cancel = false;
// Write your code here.
}
}
}
After writing the code publish the infopath form.u can check the following link.
if any infopath form have code then u can check the 2nd option of publishing.
Publish a Infopath Form
Save Infopath Data into Database.
[WebMethod]
public void InsertVillage(int villageId,string CatA,string DDLA,string CatB,string DDLB)
{
cmd = new SqlCommand("select * from Entry", con);
mydataset = new DataSet();
myadapter = new SqlDataAdapter(cmd);
myadapter.Fill(mydataset);
string strsql = string.Empty;
strsql = "insert into Entry values(" + villageId + ",'" + CatA + "','" + DDLA + "','" + CatB + "','" + DDLB + "')";
cmd.ExecuteNonQuery();
}
Now click on Submit Options.. button.
(ii) Select Web service option from first dropdown list.If you have already added a data connection, you can choose from second dropdown list or click Add button to add a new data connection.The popup window looks like: 
(iii) Enter your web services address.
(iv) Select Submit data option.

(v)Choose the first option to submit data through web service.

Fill dropdown from the selection of another dropdown





(viii) after completing the above process we will select datasource from the DropDown.


Binding Checkbox in Infopath 2007
Create A New InfoPath 2007 Form
there are 2 ways to design a form in template part
- TextBox
- RichTextBox
- Dropdownlist
- ListBox
- DatePicker
- Checkbox
- Option Button
- Button
- Section(Section is used as a container like panel control in asp.net)
Conditional Display Formatting of Control in Infopath Form
(iii) From first dropdown list select the control/field on the basis of which you want to make the control disable.



How to publish a Infopath Form






(v) Verify the Form information.
click on publish button
(vi) when we click on publish the infopath save the form in sharepoint.
and form will be saved.






How we uplaod a infopath form using Sharepoint Central administarion 3.0.

when we click on ok button then page will be uploaded successfully. If any error then it will shows.

(ii) How we activate the form.

(iii) Go to Site Collection Administration | site collection features and the activate the form.

(iv) Go to Main Site and select Form Setting and select advanced setting.

(V) From Content Type section click on Add from existing site content types link button.

(v)Select the page from the list and add the form in the existing Collection Library.

After adding the page you will be back on previous page.The added page will we displayed in Content Types.

(vi)Click the form in Form menu.Select New from menu.It will display a list of available page.Select your page and it willl be opened in the browser.











