<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: How to create an infopath form using a template and a data connection?</title><link>https://www.infopathdev.com:443/forums/thread/30519.aspx</link><pubDate>Wed, 16 Jul 2008 21:14:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30519</guid><dc:creator>pweissbrod</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30519.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=30519</wfw:commentRss><description>&lt;p&gt;I found a solution that works for my needs. This is in C# 3.5:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I created a gridview that lists all of the employees.&lt;/p&gt;&lt;p&gt;In the gridview is a button, that fires the rowcommand:&lt;/p&gt;&lt;p&gt;protected void grdEmployees_RowCommand(object sender, GridViewCommandEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (e.CommandName == &amp;quot;Sort&amp;quot; || e.CommandName == &amp;quot;Page&amp;quot;) //if you are sorting or paging, then ignore the call in this method.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //retrieve some of the data from the selected row&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridViewRow gridViewRow = grdEmployees.Rows[(Convert.ToInt32(e.CommandArgument))];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string firstName = gridViewRow.Cells[1].Text;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string lastName = gridViewRow.Cells[2].Text;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string jobTitle = gridViewRow.Cells[3].Text;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //open up the infopath form&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var xmlDocument = new XmlDocument {PreserveWhitespace = true}; //this is important, you need to preserve the white space of the original infopath form or else the xmldocument will add whitespace and corrupt the file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlDocument.Load(@&amp;quot;C:\InfoPathForm.xml&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var xmlNamespaceManager = new XmlNamespaceManager(xmlDocument.NameTable);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlNamespaceManager.AddNamespace(&amp;quot;my&amp;quot;, &amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-06-24T18:21:03&amp;quot;); //add the prefix for the &amp;quot;my:&amp;quot; namespace&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //set values&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlDocument.SelectSingleNode(&amp;quot;/my:myFields/my:SubjectName&amp;quot;, xmlNamespaceManager).InnerText = firstName + &amp;quot; &amp;quot; + lastName; //pre-populate some values from the grid into the form&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string fileName = firstName + &amp;quot; &amp;quot; + lastName;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileName = fileName.Replace(&amp;quot; &amp;quot;, &amp;quot;_&amp;quot;) + &amp;quot;.xml&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //set the response&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var stringBuilder = new StringBuilder();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var xmlDeclaration = (XmlDeclaration) xmlDocument.FirstChild;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlDeclaration.Encoding = &amp;quot;UTF-8&amp;quot;;&amp;nbsp; //this is important, make sure that the encoding is UTF8&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlDocument.Save(new StringWriter(stringBuilder));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.ClearHeaders();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Clear();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.AddHeader(&amp;quot;content-disposition&amp;quot;, &amp;quot;attachment;filename=&amp;quot;+fileName); //this line will force the user to save the file (instead of saving it on the browser)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.ContentType = &amp;quot;application/xml&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.ContentEncoding = Encoding.UTF8;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //prep anything that infopath will have problems parsing&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string xmlFile = stringBuilder.ToString();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlFile = xmlFile.Replace(&amp;quot;encoding=\&amp;quot;utf-16\&amp;quot;?&amp;gt;&amp;quot;, &amp;quot;encoding=\&amp;quot;utf-8\&amp;quot;?&amp;gt;&amp;quot;);//this line is important, if you dont specify UTF8 encoding infopath will not open the document&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //deliver the file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write(xmlFile);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.End();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How to create an infopath form using a template and a data connection?</title><link>https://www.infopathdev.com:443/forums/thread/30510.aspx</link><pubDate>Wed, 16 Jul 2008 16:11:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30510</guid><dc:creator>pweissbrod</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30510.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=30510</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;chandrakanth --&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;This is good information, but I think that what I need is a way to pre-populate some fields in an infopath form using values from a database and then send it to the user.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How to create an infopath form using a template and a data connection?</title><link>https://www.infopathdev.com:443/forums/thread/30497.aspx</link><pubDate>Wed, 16 Jul 2008 14:03:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30497</guid><dc:creator>chandrakanth</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30497.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=30497</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I hope this link will help you.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/elenat/archive/2008/05/13/designing-an-infopath-form-that-can-store-data-in-a-database-part3.aspx"&gt;http://blogs.technet.com/elenat/archive/2008/05/13/designing-an-infopath-form-that-can-store-data-in-a-database-part3.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>How to create an infopath form using a template and a data connection?</title><link>https://www.infopathdev.com:443/forums/thread/30492.aspx</link><pubDate>Wed, 16 Jul 2008 12:50:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30492</guid><dc:creator>pweissbrod</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30492.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=30492</wfw:commentRss><description>&lt;p&gt;Hi and thanks in advance for the help!&lt;/p&gt;&lt;p&gt;I went through the trouble of designing a dynamic and clean form, but now I am a little hung up on how to deploy it to my users.&lt;/p&gt;&lt;p&gt;I have a table from an ODBC source which is a list of employees.&lt;/p&gt;&lt;p&gt;I want to make a web page that show the list of employees, when the user clicks on an employee, the server will send the user an infopath form with some of the employee-specific data pre-populated.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Can someone point me in the right direction?&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>