<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-13518618</id><updated>2012-01-19T00:31:31.046-08:00</updated><category term='Forms Services'/><category term='Entity Framework'/><title type='text'>Sumeet-Tech</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sumeetrattan.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13518618/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sumeetrattan.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sumeet</name><uri>http://www.blogger.com/profile/00588213342896123854</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-13518618.post-5413876495354091188</id><published>2010-08-08T10:33:00.001-07:00</published><updated>2010-11-26T22:33:15.604-08:00</updated><title type='text'>Configuring IIS Development Environment for HTTPS</title><content type='html'>&lt;p&gt;When testing code for https on development environments its usually an annoyance to skip the browser page which states that certificate is not trusted. But in many scenarios where we are dealing with https requested out side of the browser it make development and testing very tedious. Although this post applies to https configuration in IIS, my most recent requirement was to enable message level security on WCF channel.&lt;/p&gt;&lt;p&gt;This might be applicable to other development environments but my assumptions are:&lt;/p&gt;&lt;p&gt;1. Window 7 64 bit.&lt;br /&gt;1. Visual Studio 2010 (this installs makecert.exe)&lt;br /&gt;2. IIS&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; The certificate we are going to create is used on IIS site and will be tied to the FQDN of the site you are going to use it on.&lt;br /&gt;[Main directions were originally taken from &lt;a title="http://blog.aggregatedintelligence.com/2010/04/using-makecert-to-create-certificate.html" href="http://blog.aggregatedintelligence.com/2010/04/using-makecert-to-create-certificate.html"&gt;&lt;span style="color:#ffffff;"&gt;http://blog.aggregatedintelligence.com/2010/04/using-makecert-to-create-certificate.html&lt;/span&gt;&lt;/a&gt;]&lt;/p&gt;&lt;p&gt;I am adding some more context and fixing some roadblocks I faced while addressing the problems on my local environment…&lt;/p&gt;&lt;p&gt;&lt;strong&gt;1. Run Visual Studio 2010 &amp;gt; Visual Studio Tools &amp;gt; Visual Studio Command Prompt &lt;/strong&gt;(right click and run as Administrator)&lt;/p&gt;&lt;p&gt;&lt;strong&gt;2. Optionally change to working directory to root drive just to make it easy to access files &amp;gt; cd\&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;1. Create a Certificate which represent our fake version of Root Certification Authority (in real world this will be Versign, Geotrust etc and will cost $$)&lt;/strong&gt; &lt;blockquote&gt;&lt;p&gt;&lt;code&gt;makecert -r -pe -n "CN=&lt;strong&gt;Development Root Certification Authority&lt;/strong&gt;" -ss Root -sr localMachine -a sha1 -sky signature -sv &lt;strong&gt;DevelopmentRoot.pvk &lt;/strong&gt;DevelopmentRoot.cer&lt;/code&gt; &lt;p&gt;&lt;code&gt;&lt;strong&gt;[Passwords are optional. I chose none.]&lt;/strong&gt;&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Type “certmgr” at command prompt and verify if this certificate was installed in “Trusted Root Certification Authority”. &lt;p&gt;&lt;strong&gt;2. Now that we have a Certification Authority, we can use this certification authority to issue certificate to ourselves.&lt;/strong&gt; &lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;&lt;strong&gt;2a.&lt;/strong&gt;&lt;br /&gt;&lt;/code&gt;makecert -pe -n "CN=REPLACE THIS WITH YOUR FULL COMPUTER" -a sha1 -sky exchange -eku 1.3.6.1.5.5.7.3.1 -ic DevelopmentRoot.cer -iv DevelopmentRoot.pvk -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 –sv DevelopmentSite.pvk DevelopmentSite.cer&lt;/pre&gt;&lt;pre&gt;&lt;code&gt;&lt;strong&gt;2b.&lt;/strong&gt;&lt;br /&gt;pvk2pfx -pvk &lt;code&gt;DevelopmentSite&lt;/code&gt;.pvk -spc &lt;code&gt;DevelopmentSite&lt;/code&gt;.cer -pfx &lt;code&gt;DevelopmentSite&lt;/code&gt;.pfx&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;p&gt;Then go back to certmgr and import the pfx file created in this step to Root Certification Authority store. (This can probably go in some other store but due to shortage of time I just added it to Root Cert Auth. By doing this it shows up in IIS as available certificate to be associated with https binding).&lt;br /&gt;&lt;p&gt;Also import the pfx file created in step 2b. into IIS. Run inetmgr, click on the root node and then click on Server Certificates in the right pane.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;note that for –n “CN=&lt;span style="color:#ff0000;"&gt;REPLACE THIS WITH YOUR FULL COMPUTER&lt;/span&gt;” you must make sure that you use Full computer name here. For example if your computer is part of a domain then you should use MachineName.DomanName as the cn name. (You can also verify this by right clicking on my computer &amp;gt; properties &amp;gt; FullComputerName)&lt;br /&gt;&lt;p&gt;&lt;strong&gt;3. Create HTTPS binding for the site and use &lt;code&gt;DevelopmentSite&lt;/code&gt; certificate created above.&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;4. To test the certificate browse to &lt;a href="https://machinename.domainname.com/"&gt;https://machinename.domainname.com/&lt;/a&gt; and you should not get any certificate errors.&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;Note that https support is not available in Cassini. Although I have heard that there is a VS2010 solution in works. Until we hear more about that and https support this requires that you configure your site in IIS.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13518618-5413876495354091188?l=sumeetrattan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sumeetrattan.blogspot.com/feeds/5413876495354091188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13518618&amp;postID=5413876495354091188' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13518618/posts/default/5413876495354091188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13518618/posts/default/5413876495354091188'/><link rel='alternate' type='text/html' href='http://sumeetrattan.blogspot.com/2010/08/configuring-iis-development-environment.html' title='Configuring IIS Development Environment for HTTPS'/><author><name>Sumeet</name><uri>http://www.blogger.com/profile/00588213342896123854</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13518618.post-913482619796250016</id><published>2010-06-23T12:07:00.001-07:00</published><updated>2010-06-23T12:08:39.850-07:00</updated><title type='text'>Mocking Web Service For Silverlight Consumption</title><content type='html'>&lt;p&gt;One of my colleague ran into this typical dependency chain. The requirement was to show data in a Silverlight 3.0 data grid. Picture below summarizes the dependency chain. This picture is the very reason why we have IOC frameworks and how they make life easy. I mean, why should my Datagrid care about the fact that Synch framework is doing its job properly or not.    &lt;br /&gt;    &lt;br /&gt;&lt;img style="border-right-width: 0px; margin: 0px 25px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Dependency" border="0" alt="Dependency" align="left" src="http://lh6.ggpht.com/_R5oY7a1_KfY/TCJbh-y0CXI/AAAAAAAAAIA/Bavg5LEYvy8/Dependency3.png?imgmax=800" width="415" height="386" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;You can imagine how much time it would take for the developer working on the datagrid to resolve all the preceding 8 dependencies just to bind to the grid. Welcome to IOC (for those of you going “oh not again” please read on, there is little twist, at least it was for me).&lt;/p&gt;  &lt;p&gt;Ideally we should only be concerned about our ViewModel and nothing else. Since ViewModel is using a WCF Proxy we already have an interface that we can mock. And here lies the key:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Mock the web service interface and inject it using the UnityBootstrapper&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If you have basic Prism project injection should be straight forward. This is what we did in our bootstrapper:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;this&lt;/span&gt;.Container.RegisterType&amp;lt;IMyService, MyServiceMock&amp;gt;();&lt;br /&gt;myModel = IMyService.GetData();&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Everything was smooth until this point in refactoring. Than I ran into trouble with actual mock implementation of the interface serialized in WCF proxy. Since all the methods get serialized into their corresponding Begin and End versions and the fact that everything in Silverlight 3.0 framework requires you to make asynchronous calls, you cannot just create straight interface mock and start binding.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Basically you have to be aware that you are mocking the asynchronous version of the interface and should not attempt to capture the underlying channel details in the mock. Given below is the code and new (much shorter and required) dependency chain I ended up with:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MyServiceMock : IMyService&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; MyServiceMock()&lt;br /&gt;    { }&lt;br /&gt;&lt;br /&gt;    &lt;span class="preproc"&gt;#region&lt;/span&gt; IMyServiceMembers&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; IAsyncResult BeginMyMethod(AsyncCallback callback, &lt;span class="kwrd"&gt;object&lt;/span&gt; asyncState)&lt;br /&gt;    {&lt;br /&gt;        &lt;font size="2"&gt;&lt;strong&gt;callback.Invoke(&lt;span class="kwrd"&gt;null&lt;/span&gt;);  // &amp;lt;—Trick your caller and tell them async operation complete right away&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;null&lt;/span&gt;;   &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; ObservableCollection&amp;lt;MyClass&amp;gt; EndMyMethod(IAsyncResult result)&lt;br /&gt;    {&lt;br /&gt;        ObservableCollection&amp;lt;MyClass&amp;gt; mockedList = &lt;span class="kwrd"&gt;new&lt;/span&gt; ObservableCollection&amp;lt;MyClass&amp;gt;();&lt;br /&gt;        mockedList.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; MyClass());&lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; mockedList;&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e0e6ac92-e934-4acd-8c99-502adc6ec190" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Silverlight" rel="tag"&gt;Silverlight&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Unity" rel="tag"&gt;Unity&lt;/a&gt;,&lt;a href="http://technorati.com/tags/MVVM" rel="tag"&gt;MVVM&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Prism" rel="tag"&gt;Prism&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre class="csharpcode"&gt;    &lt;span class="preproc"&gt;#endregion&lt;/span&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre class="csharpcode"&gt;*I am assuming no mocking framework is being used but the notion will still translate.&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here is the new dependency chain for testing my UI. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://lh5.ggpht.com/_R5oY7a1_KfY/TCJbi6HTB_I/AAAAAAAAAIE/mm4H2KOlPko/s1600-h/ShortDependency11.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="ShortDependency" border="0" alt="ShortDependency" src="http://lh3.ggpht.com/_R5oY7a1_KfY/TCJbjj9aFkI/AAAAAAAAAII/EpWNmGNTYRQ/ShortDependency_thumb7.png?imgmax=800" width="427" height="98" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;Short, Sweet and Testable.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13518618-913482619796250016?l=sumeetrattan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sumeetrattan.blogspot.com/feeds/913482619796250016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13518618&amp;postID=913482619796250016' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13518618/posts/default/913482619796250016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13518618/posts/default/913482619796250016'/><link rel='alternate' type='text/html' href='http://sumeetrattan.blogspot.com/2010/06/mocking-web-service-for-silverlight.html' title='Mocking Web Service For Silverlight Consumption'/><author><name>Sumeet</name><uri>http://www.blogger.com/profile/00588213342896123854</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_R5oY7a1_KfY/TCJbh-y0CXI/AAAAAAAAAIA/Bavg5LEYvy8/s72-c/Dependency3.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13518618.post-3904093691437995374</id><published>2008-06-08T20:24:00.000-07:00</published><updated>2008-06-09T06:53:00.629-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Entity Framework'/><title type='text'>Entity framework and OpenFileDialog</title><content type='html'>Bugs manifest themselve in a strangest possible ways. Here is one of those...&lt;br /&gt;&lt;br /&gt;1. Created a Winform App&lt;br /&gt;2. One one of the forms in my app invoked window's OpenFileDialog&lt;br /&gt;3. After closing the OpenFileDialog (not cancelling), any call to create new ObjectContext fails with following error:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;em&gt;The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource.&lt;/em&gt;&lt;/blockquote&gt;&lt;br /&gt;Strange right ? How on earth can OpenFileDialog affect the creation of ObjectContext ?&lt;br /&gt;After some close inspection and frustration, it turns out that the error message is actually pointitng to a correct cause:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;em&gt;&lt;strong&gt;The specified metadata path is not valid&lt;/strong&gt;&lt;/em&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Reason and Solution:&lt;br /&gt;&lt;br /&gt;1. I have not decompiled or looked at the Entity framework code but at this point I am certian that the default constructor (the one which look at the connection string) of ObjectContext is trying to load the metadata from Environment.CurrentDirectory.&lt;br /&gt;2. When application is started the Environment.CurrentDirectory = Application.StartupPath, therefore everything is happy and functional.&lt;br /&gt;3. After closing the OpenFileDialog the Environment.CurrentDirectory property changes to wherever the dialog was pointing to.&lt;br /&gt;4. But the connectionstring in appconfig is still point to "./*" which is transalting to Environment.CurrentDirectory, thus causing the load error.&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;br /&gt;Either change the autogenerated connection string to point to an absolute path.&lt;br /&gt;Or&lt;br /&gt;Anytime you change the Environment.CurrentDirectory property, remember to change it back to Environment.CurrentDirectory = Application.StartupPath&lt;br /&gt;Or&lt;br /&gt;Wait for the next release, hoping that the bug will be fixed after somebody reads this post ;-)&lt;br /&gt;&lt;br /&gt;If this post does not help you then there is another one&lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2532468&amp;SiteID=1"&gt;here&lt;/a&gt; which explains the solution for the same error message but under totally different and unrelated circumstances.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13518618-3904093691437995374?l=sumeetrattan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sumeetrattan.blogspot.com/feeds/3904093691437995374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13518618&amp;postID=3904093691437995374' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13518618/posts/default/3904093691437995374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13518618/posts/default/3904093691437995374'/><link rel='alternate' type='text/html' href='http://sumeetrattan.blogspot.com/2008/06/entity-framework-and-openfiledialog.html' title='Entity framework and OpenFileDialog'/><author><name>Sumeet</name><uri>http://www.blogger.com/profile/00588213342896123854</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13518618.post-5899989539860493108</id><published>2007-05-18T10:56:00.000-07:00</published><updated>2007-05-18T11:28:31.036-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Forms Services'/><title type='text'>Switching View in Infopath form from WebForm host</title><content type='html'>Infopath browser enabled forms offer a lot of flexibility and productivity. But with all the moving pieces involved in development and deployment of:&lt;br /&gt;&lt;br /&gt;"Browser enabled - administrative approved - full trust - deployed to Sharepoint as feature-hosted in a web part" forms,&lt;br /&gt;&lt;br /&gt;encoutering some simple glitches can cause some trouble. A solution to one of these small thing is posted here...&lt;br /&gt;&lt;br /&gt;The scenario: &lt;strong&gt;You have a form with multiple view but want to invoke switch view from an ASPX hosting enviroment..&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;/strong&gt;1. Enable toolbars in your form (Tools-&gt; Form Options -&gt; Browser-&gt; ShowToolbars)&lt;br /&gt;2. Deploy it to a site collection and enable Web Page viewing from advance option in Form Template Library&lt;br /&gt;3. Create a hosting environ. Use XML Form View control in your Web part or on your ASPX running under Form Services context.&lt;br /&gt;4. Set the XsnLocation on the FormViewer control and open in browser.&lt;br /&gt;5. View html source of the generated web page and you will find&lt;br /&gt;"Toolbar.HandleViewSwitching(this)" being called on on change of a dropdown.&lt;br /&gt;6. That's it !!! now go back disable the tollbars from your form and redeploy.&lt;br /&gt;7. This time the drop down will not be rendered, hence no code to switch views.&lt;br /&gt;8. Implement some code to spit out a drop down to you html. (You can do that in render method of you web part or pre render of your page, what ever makes more sense in your implementation)&lt;br /&gt;9. Now istead of calling "Toolbar.HandleViewSwitching(this)" with this just pass in a reference to your drop down !!!&lt;br /&gt;&lt;br /&gt;Here is a sample code:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function ChangeView(viewName)&lt;br /&gt;{&lt;br /&gt;    var dd = document.getElementById("FakeDropdown");&lt;br /&gt;    dd.value=viewName;&lt;br /&gt;    Toolbar.HandleViewDropdown(dd);&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;select id="FakeDropdown" style="DISPLAY: none"&amp;gt; &amp;lt;option value="'View"&amp;gt;View1&amp;lt;/option&amp;gt; &amp;lt;option value="'View2'"&amp;gt;View2&amp;lt;/option&amp;gt;&amp;lt;/select&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div onclick="ChangeView('View2')"&amp;gt;Click Me&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;This instructs the in memory from viewer script to think that view change is requested.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13518618-5899989539860493108?l=sumeetrattan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sumeetrattan.blogspot.com/feeds/5899989539860493108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13518618&amp;postID=5899989539860493108' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13518618/posts/default/5899989539860493108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13518618/posts/default/5899989539860493108'/><link rel='alternate' type='text/html' href='http://sumeetrattan.blogspot.com/2007/05/switching-view-in-infopath-form-from.html' title='Switching View in Infopath form from WebForm host'/><author><name>Sumeet</name><uri>http://www.blogger.com/profile/00588213342896123854</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
