<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SharePoint Fun &#187; ASP.NET</title>
	<atom:link href="http://blog.qumsieh.ca/category/aspnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.qumsieh.ca</link>
	<description>Developer's blog related to ASP.NET, SharePoint and Telerik Web Controls</description>
	<lastBuildDate>Fri, 27 Jan 2012 19:08:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>&#8220;Invalid postback or callback argument&#8221; DropDownList and ClientSide Append</title>
		<link>http://blog.qumsieh.ca/2011/03/22/invalid-postback-or-callback-argument-dropdownlist-and-clientside-append/</link>
		<comments>http://blog.qumsieh.ca/2011/03/22/invalid-postback-or-callback-argument-dropdownlist-and-clientside-append/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 22:18:54 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=738</guid>
		<description><![CDATA[Populating an ASP.NET dropdownlist on the client side might cause an Invalid postback or callback argument error. This post describes how to address that issue by registering the valid values using ClientScript.RegisterForEventValidation.]]></description>
			<content:encoded><![CDATA[<p>I feel this particular issue really deserves a blog post due to the sheer number of bad answers that are out there that don&#8217;t really address or explain the underlying issue.</p>
<p><strong>Scenario</strong>: Let&#8217;s say you have an <strong>asp:DropDownList</strong> control that you populate with three values in your <strong>Page_Load</strong> event:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;</span>asp<span style="color: #008000;">:</span>DropDownList ID<span style="color: #008000;">=</span><span style="color: #666666;">&quot;rcbStatus&quot;</span> ToolTip<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Status&quot;</span> runat<span style="color: #008000;">=</span><span style="color: #666666;">&quot;server&quot;</span> Width<span style="color: #008000;">=</span><span style="color: #666666;">&quot;200px&quot;</span><span style="color: #008000;">&gt;</span>
    <span style="color: #008000;">&lt;</span>asp<span style="color: #008000;">:</span>ListItem Value<span style="color: #008000;">=</span><span style="color: #666666;">&quot;1&quot;</span> Text<span style="color: #008000;">=</span><span style="color: #666666;">&quot;A&quot;</span><span style="color: #008000;">&gt;&lt;/</span>asp<span style="color: #008000;">:</span>ListItem<span style="color: #008000;">&gt;</span>
    <span style="color: #008000;">&lt;</span>asp<span style="color: #008000;">:</span>ListItem Value<span style="color: #008000;">=</span><span style="color: #666666;">&quot;2&quot;</span> Text<span style="color: #008000;">=</span><span style="color: #666666;">&quot;B&quot;</span><span style="color: #008000;">&gt;&lt;/</span>asp<span style="color: #008000;">:</span>ListItem<span style="color: #008000;">&gt;</span>
    <span style="color: #008000;">&lt;</span>asp<span style="color: #008000;">:</span>ListItem Value<span style="color: #008000;">=</span><span style="color: #666666;">&quot;3&quot;</span> Text<span style="color: #008000;">=</span><span style="color: #666666;">&quot;C&quot;</span><span style="color: #008000;">&gt;&lt;/</span>asp<span style="color: #008000;">:</span>ListItem<span style="color: #008000;">&gt;</span>
<span style="color: #008000;">&lt;/</span>asp<span style="color: #008000;">:</span>DropDownList<span style="color: #008000;">&gt;</span></pre></div></div>

<p>which renders as:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;select&gt;
    &lt;option value=&quot;1&quot;&gt;A&lt;/option&gt;
    &lt;option value=&quot;2&quot;&gt;B&lt;/option&gt;
    &lt;option value=&quot;3&quot;&gt;C&lt;/option&gt;
&lt;/select&gt;</pre></div></div>

<p>Now let&#8217;s say you want to manipulate the above using client side javascript and perhaps alter/append or remove options from the above <strong>select</strong> based on some other selection. So we end up with a <strong>select</strong> control that looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&lt;%= rcbStatus.ClientID %&gt;&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;option&gt;&lt;/option&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'4'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'D'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;select&gt;
    &lt;option value=&quot;1&quot;&gt;A&lt;/option&gt;
    &lt;option value=&quot;2&quot;&gt;B&lt;/option&gt;
    &lt;option value=&quot;3&quot;&gt;C&lt;/option&gt;
    &lt;option value=&quot;4&quot;&gt;D&lt;/option&gt;
&lt;/select&gt;</pre></div></div>

<p>Now go ahead and select option &#8220;D&#8221; and attempt a submit, you will receive an error as follows (if <strong>EnableEventValidation</strong> is <strong>true</strong>, which is the default):</p>
<blockquote><p>
<span style="color:red">Invalid postback or callback argument.  Event validation is enabled using
<pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.</span>
</p></blockquote>
<p>Now sites like stackoverflow and several other blogs outline the following as potential fixes for this error:</p>
<ul>
<li>Set <strong>EnableEventValidation</strong> to <strong>false</strong> and of course the above submit will work. The reasoning is that you shouldn&#8217;t be relying on <strong>EventValidation</strong> to ensure that input from the user/page is what you expect and is valid input.</li>
<li>Use an <strong>AJAX Update Panel</strong> or a <strong>Telerik RadUpdatePanel</strong> to handle the change client side.</li>
<li>Use a <strong>select</strong> control natively, instead of an <strong>asp:DropDownList</strong> and use <strong>Request.Form</strong> to access it&#8217;s selected value on submit.</li>
<li>Or finally, do what the error is suggesting and register the possible range of values using <strong>ClientScript.RegisterForEventValidation</strong>.</li>
</ul>
<p>I&#8217;m going to demonstrate the last option there, as it&#8217;s the one that makes the most sense for my particular scenario. Add an <strong>override</strong> for the <strong>Render</strong> method in your server side code as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> Render<span style="color: #000000;">&#40;</span>HtmlTextWriter writer<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    Page.<span style="color: #0000FF;">ClientScript</span>.<span style="color: #0000FF;">RegisterForEventValidation</span><span style="color: #000000;">&#40;</span>rcbStatus.<span style="color: #0000FF;">UniqueID</span>, <span style="color: #666666;">&quot;4&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Render</span><span style="color: #000000;">&#40;</span>writer<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Now for option D in my select, with a value of 4, the <strong>EventValidation</strong> is aware that 4 is a valid and expected result and the submit will occur without issue. So basically, we&#8217;re telling ASP.NET what is valid and to continue on if you encounter these entries that did not exist in the original state of the drop down list when it was rendered.</p>
<p>Please note that specifying &#8220;D&#8221; as the second parameter in the <strong>RegisterForEventValidation</strong> method did not work for me, it had to be the <strong>option</strong> <strong>value</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2011/03/22/invalid-postback-or-callback-argument-dropdownlist-and-clientside-append/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Determine Entity Type in PeopleEditor Control</title>
		<link>http://blog.qumsieh.ca/2010/11/04/how-to-determine-entity-type-in-peopleeditor-control/</link>
		<comments>http://blog.qumsieh.ca/2010/11/04/how-to-determine-entity-type-in-peopleeditor-control/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 00:13:36 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[PeopleEditor]]></category>
		<category><![CDATA[SharePoint 2007]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=719</guid>
		<description><![CDATA[Because I don&#8217;t write nearly enough on this topic, I figured why not add another post about the splendid PeopleEditor control for SharePoint. Actually, these posts happen to be among my most popular. So popular in fact, that they are constantly being stolen and posted on other blogs without so much as a courtesy ping [...]]]></description>
			<content:encoded><![CDATA[<p>Because I don&#8217;t write nearly enough on this topic, I figured why not add another post about the splendid <strong>PeopleEditor</strong> control for SharePoint. Actually, these posts happen to be among my most popular. So popular in fact, that they are constantly being stolen and posted on other blogs without so much as a courtesy ping back! I won&#8217;t point any of those users out as they don&#8217;t deserve any precious link love. However, if you come across a <strong>PeopleEditor</strong> post that looks suspiciously like mine, I&#8217;m the original author!</p>
<p>Ok, so now that my rant is over, let&#8217;s go over a new trick I recently discovered when working with the <strong>PeopleEditor</strong>. Whenever I&#8217;ve worked with this control in the past, I&#8217;ve usually only dealt with <strong>SelectionSets</strong> that are limited to <strong>Users</strong>. So there has never been a need to handle entries where groups are specified. In case you are not familiar, here is a listing of the possible options for the <strong>SelectionSet</strong> property, posted by <a href="http://msdn.microsoft.com/en-us/library/community/user/155976.aspx">Alex</a> and <a href="http://msdn.microsoft.com/en-us/library/community/user/27262.aspx">Ozaki</a> on the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.peopleeditor.selectionset(office.12).aspx">MSDN PeopleEditor.SelectionSet Page</a> &#8211; Community Section: </p>
<ul>
<li>User = single user</li>
<li>DL = AD distribution list</li>
<li>SecGroup = AD security group</li>
<li>SPGroup = SharePoint group</li>
</ul>
<p>I came across this requirement recently. More specifically, I needed to be able to save both users and groups, but obviously the logic for saving those is a little different. So we need a mechanism that helps us determine what type of entity a user has provided and based on that, process the correct save method.</p>
<p>So, let&#8217;s say we have a PeopleEditor defined as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;</span>SharePoint<span style="color: #008000;">:</span>PeopleEditor ID<span style="color: #008000;">=</span><span style="color: #666666;">&quot;peManager&quot;</span> runat<span style="color: #008000;">=</span><span style="color: #666666;">&quot;server&quot;</span> MultiSelect<span style="color: #008000;">=</span><span style="color: #666666;">&quot;false&quot;</span> Width<span style="color: #008000;">=</span><span style="color: #666666;">&quot;200px&quot;</span> AllowEmpty<span style="color: #008000;">=</span><span style="color: #666666;">&quot;true&quot;</span> SelectionSet<span style="color: #008000;">=</span><span style="color: #666666;">&quot;User,SPGroup&quot;</span> <span style="color: #008000;">/&gt;</span></pre></div></div>

<p>Now we want to save whatever the user enters into a column of type <strong>Person or Group</strong> that can accept both users and groups.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>PickerEntity entity <span style="color: #0600FF;">in</span> peManager.<span style="color: #0000FF;">ResolvedEntities</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">switch</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span>entity.<span style="color: #0000FF;">EntityData</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;PrincipalType&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">case</span> <span style="color: #666666;">&quot;User&quot;</span><span style="color: #008000;">:</span>
            item<span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Assigned&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> SavePeopleEditorControl<span style="color: #000000;">&#40;</span>peManager.<span style="color: #0000FF;">CommaSeparatedAccounts</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            break<span style="color: #008000;">;</span>
        <span style="color: #0600FF;">case</span> <span style="color: #666666;">&quot;SharePointGroup&quot;</span><span style="color: #008000;">:</span>
            SPGroup group <span style="color: #008000;">=</span> web.<span style="color: #0000FF;">Groups</span><span style="color: #000000;">&#91;</span>entity.<span style="color: #0000FF;">EntityData</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;AccountName&quot;</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
            item<span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Assigned&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> group<span style="color: #008000;">;</span>
            break<span style="color: #008000;">;</span>
        <span style="color: #008080; font-style: italic;">// add additional case statements for the other SelectionSets</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>There you have it. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2010/11/04/how-to-determine-entity-type-in-peopleeditor-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RadGrid How To &#8211; Configure a HyperLink Client Side</title>
		<link>http://blog.qumsieh.ca/2009/11/24/radgrid-how-to-configure-a-hyperlink-client-side/</link>
		<comments>http://blog.qumsieh.ca/2009/11/24/radgrid-how-to-configure-a-hyperlink-client-side/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 01:45:58 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Telerik]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=587</guid>
		<description><![CDATA[I&#8217;ve been doing a lot of work recently with Telerik&#8217;s RadGrid configuration client side. This includes data binding, sorting, paging and working with columns and data rows. I&#8217;ll likely be doing a series on some of the issues I&#8217;ve encountered trying to work with these grids completely client side. The first of this series is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a lot of work recently with Telerik&#8217;s <a href="http://www.telerik.com">RadGrid</a> configuration client side. This includes data binding, sorting, paging and working with columns and data rows. I&#8217;ll likely be doing a series on some of the issues I&#8217;ve encountered trying to work with these grids completely client side. The first of this series is a relatively simple thing to do server side, but I definitely had issue with it client side.</p>
<p>Scenario:</p>
<p>I have a <strong>RadGrid</strong> called rgProjects configured with several <strong>GridBoundColumn</strong> fields and a single <strong>GridHyperLinkColumn</strong> field. The data binding for this grid is being done via an ajax call to a method in another page that returns some <a href="http://www.json.org">json</a> that I then bind to the grid. I&#8217;m leveraging the <strong>OnRowDataBound</strong> client event of this grid to perform some custom row manipulation. I figured this would be a good place to set up my HyperLink.</p>
<p><span style="text-decoration: underline;">Step 1 - Add the GridHyperLinkColumn to the grid</span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;telerik:RadGrid ID=&quot;rgProjects&quot; EnableViewState=&quot;false&quot; runat=&quot;server&quot;
            GridLines=&quot;None&quot; AutoGenerateColumns=&quot;False&quot; AllowSorting=&quot;true&quot; Width=&quot;100%&quot;&gt;
            &lt;MasterTableView TableLayout=&quot;Fixed&quot;&gt; 
                &lt;Columns&gt;
                    &lt;telerik:GridNumericColumn DataField=&quot;ID&quot; HeaderText=&quot;ID&quot; /&gt;
                    &lt;telerik:GridNumericColumn DataField=&quot;Title&quot; HeaderText=&quot;Title&quot; Display=&quot;false&quot; /&gt;
                    &lt;telerik:GridHyperLinkColumn DataTextField=&quot;Project&quot; DataNavigateUrlFields=&quot;Project&quot;
                        UniqueName=&quot;Project&quot; HeaderText=&quot;Project&quot; ItemStyle-Font-Underline=&quot;true&quot; /&gt;
                &lt;/Columns&gt;
            &lt;/MasterTableView&gt;
            &lt;ClientSettings&gt;
                &lt;ClientEvents OnRowDataBound=&quot;rgProjects_OnRowDataBound&quot; /&gt;
            &lt;/ClientSettings&gt;
&lt;/telerik:RadGrid&gt;</pre></td></tr></table></div>

<p>The JSON that&#8217;s being returned:</p>
<p>[{"ID":"1204","Title":"shereen's test project","Project":"http://server.local/_layouts/Demo/editform.aspx?ID=1204"}]</p>
<p>So the basic idea was, I wanted my hyperlink to have it&#8217;s value set to: &#8220;shereen&#8217;s test project&#8221; and I wanted the url to be set to: http://server.local/_layouts/Demo/editform.aspx?ID=1204. </p>
<blockquote><p>Do not confuse TITLE with VALUE. By TITLE, I mean the actual TITLE attribute of the A tag that&#8217;s used for a tooltip and by VALUE I mean the innerHTML that&#8217;s set and is actually visible to the user as the hyperlink itself. </p></blockquote>
<p>So it would read as follows:</p>
<p><a href="http://server.local/_layouts/Demo/editform.aspx?ID=1204" title="shereen's test project">shereen&#8217;s test project</a></p>
<p> This was not working for me initially because both the hyperlink&#8217;s value and url were being set as the url, which is not what I wanted:</p>
<p><a href="http://server.local/_layouts/Demo/editform.aspx?ID=1204" title="shereen's test project">http://server.local/_layouts/Demo/editform.aspx?ID=1204</a></p>
<p>In comes the OnRowDataBound event where I can override what&#8217;s happening above with what it is I actually want:</p>
<p><span style="text-decoration: underline;">Step 2 - Leverage the OnRowDataBound client event to configure our HyperLink</span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> rgProjects_OnRowDataBound<span style="color: #009900;">&#40;</span>sender<span style="color: #339933;">,</span> args<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>    
    <span style="color: #006600; font-style: italic;">// manually set the hyperlink's title</span>
    <span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066; font-weight: bold;">item</span> <span style="color: #339933;">=</span> args.<span style="color: #660066;">get_item</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> dataItem <span style="color: #339933;">=</span> args.<span style="color: #660066;">get_dataItem</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> link <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">get_cell</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Project&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>    
    link.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> dataItem.<span style="color: #660066;">Title</span><span style="color: #339933;">;</span>
    link.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> dataItem.<span style="color: #660066;">Project</span><span style="color: #339933;">;</span>
    link.<span style="color: #660066;">title</span> <span style="color: #339933;">=</span> dataItem.<span style="color: #660066;">Title</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>So the key thing to note above is you have to set the innerHTML. Title is optional, but the important ones are href and innerHTML. Any problems let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/11/24/radgrid-how-to-configure-a-hyperlink-client-side/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building jQuery Tabs That Open &amp; Close</title>
		<link>http://blog.qumsieh.ca/2009/10/27/building-jquery-tabs-that-open-close/</link>
		<comments>http://blog.qumsieh.ca/2009/10/27/building-jquery-tabs-that-open-close/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 18:55:39 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=553</guid>
		<description><![CDATA[jQuery is obviously a really powerful tool. If you&#8217;ve done any work with it, you don&#8217;t need convincing. My latest project involving jQuery was a bit tricky because I couldn&#8217;t find anything that detailed how to generate a tab once a user clicked on a link, and then how to close that tab if the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jQuery.com">jQuery</a> is obviously a really powerful tool. If you&#8217;ve done any work with it, you don&#8217;t need convincing. My latest project involving jQuery was a bit tricky because I couldn&#8217;t find anything that detailed how to generate a tab once a user clicked on a link, and then how to close that tab if the user clicked the close button. Here is my setup:</p>
<ol>
<li>I needed to create a page with some static links, that when clicked on would spawn a new tab.</li>
<li>The content area for each tab would contain a <strong>Close</strong> button that would remove the tab and hide the div contents. I didn&#8217;t want the div contents removed because I wanted users to be able to open the tabs again if they wanted to.</li>
</ol>
<p><strong>NOTE</strong>: I did attempt to dynamically generate the div contents by using a jQuery append statement on the content divs, but I ran into issues with this when placing a <a href="http://www.telerik.com">Telerik</a> RadGrid onto the page and had to abandon that approach.</p>
<p>Building the above with the <a href="http://docs.jquery.com/UI/Tabs">jQuery UI Tabs</a> library took me part of the way there. In the end, my solution looks as follows:</p>
<h3>Building the UI Tabs</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;mytabs&quot;&gt; 
   &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#tabs-home&quot;&gt;My Projects Home&lt;/a&gt;&lt;/li&gt;
   &lt;/ul&gt;
   &lt;div id=&quot;tabs-home&quot;&gt;
      &lt;h3&gt;Welcome to My Projects Home&lt;/h3&gt;
      &lt;p&gt;&lt;a href=&quot;#&quot; onclick=&quot;showTab('myActiveProjects', 'My Active Projects')&quot;&gt;My Active Projects&lt;/a&gt;&lt;/p&gt;
      &lt;p&gt;&lt;a href=&quot;#&quot; onclick=&quot;showTab('mySalesActivities', 'My Sales Activities')&quot;&gt;My Sales Activities&lt;/a&gt;&lt;/p&gt;
   &lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;tabs-myActiveProjects&quot; style=&quot;display:none;&quot;&gt;
    &lt;h3&gt;My Active Projects&lt;/h3&gt;
    &lt;p&gt;&lt;input type=&quot;button&quot; name=&quot;killTab&quot; value=&quot;Close&quot; onclick=&quot;hideTab('myActiveProjects')&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&quot;tabs-mySalesActivities&quot; style=&quot;display:none;&quot;&gt;
    &lt;h3&gt;My Sales Activities&lt;/h3&gt;
    &lt;p&gt;&lt;input type=&quot;button&quot; name=&quot;killTab&quot; value=&quot;Close&quot; onclick=&quot;hideTab('mySalesActivities')&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;</pre></td></tr></table></div>

<h3>Wiring Up The Javascript</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#mytabs&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">tabs</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> showTab<span style="color: #009900;">&#40;</span>tabID<span style="color: #339933;">,</span> tabName<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    currentTabID <span style="color: #339933;">=</span> tabID<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// this will add a tab via the standard method</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#mytabs&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">tabs</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;add&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;#tabs-&quot;</span> <span style="color: #339933;">+</span> tabID<span style="color: #339933;">,</span> tabName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#tabs-&quot;</span> <span style="color: #339933;">+</span> tabID<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;display&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;block&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#mytabs&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">tabs</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'select'</span><span style="color: #339933;">,</span> tabID<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> hideTab<span style="color: #009900;">&#40;</span>tabID<span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#tabs-&quot;</span> <span style="color: #339933;">+</span> tabID<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;display&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a[href^=#tabs-&quot;</span><span style="color: #339933;">+</span> tabID <span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;]&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#mytabs&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">tabs</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'select'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span>init<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Don&#8217;t forget to include the jQuery UI JS file and the corresponding CSS. You&#8217;ll also need to include the jQuery JS file as well. If you have any troubles with this, drop me a note.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;jquery-1.3.2.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;jquery-ui-1.7.2.custom.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>link type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/css&quot;</span> href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;styles/smoothness/jquery-ui-1.7.2.custom.css&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;stylesheet&quot;</span> <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>My next step with the above is to relocate the <strong>Close</strong> button so that it is an &#8216;X&#8217; image on the tab itself that when clicked on would close the tab. I&#8217;ll update once I figure that out! Good times!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/10/27/building-jquery-tabs-that-open-close/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>JQuery AutoComplete extraParams and CheckBoxes</title>
		<link>http://blog.qumsieh.ca/2009/09/08/jquery-autocomplete-extraparams-and-checkboxes/</link>
		<comments>http://blog.qumsieh.ca/2009/09/08/jquery-autocomplete-extraparams-and-checkboxes/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 18:29:05 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=468</guid>
		<description><![CDATA[I love jQuery. I work with it quite a lot on various projects. One of the coolest features in my humble opinion is AutoComplete. There are a ton of different plugins you can work with, some are variations of others, but for the most part, they work pretty darn good out of the box. I [...]]]></description>
			<content:encoded><![CDATA[<p>I love jQuery. I work with it quite a lot on various projects. One of the coolest features in my humble opinion is AutoComplete. There are a ton of different plugins you can work with, some are variations of others, but for the most part, they work pretty darn good out of the box.</p>
<p>I have been trying unsuccessfully over the past hour or so to pass in the value of a checkbox as a parameter to my AutoComplete plugin as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">cacheLength<span style="color: #008000;">:</span><span style="color: #FF0000;">0</span>,
minChars<span style="color: #008000;">:</span><span style="color: #FF0000;">2</span>,
max<span style="color: #008000;">:</span><span style="color: #FF0000;">20</span>,
autoFill<span style="color: #008000;">:</span><span style="color: #0600FF;">false</span>,
extraParams<span style="color: #008000;">:</span> <span style="color: #000000;">&#123;</span> active <span style="color: #008000;">:</span> $<span style="color: #000000;">&#40;</span><span style="color: #666666;">'input[name=status]'</span><span style="color: #000000;">&#41;</span>.<span style="color: #008000;">is</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">':checked'</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Now the issue I was encountering was regardless of what the state of the checkbox was, checked or unchecked, the AutoComplete plugin always returned it&#8217;s initial value. So if by default it was unchecked, it always returned false. If by default it was checked, it always returned true.</p>
<p>After a bit of digging, I finally stumbled across this site that explains that the value is locked in once the AutoComplete plugin is initialized: <a href="http://stackoverflow.com/questions/1216222/jquery-passing-checkbox-values">http://stackoverflow.com/questions/1216222/jquery-passing-checkbox-values</a></p>
<p>So to solve the issue:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">cacheLength<span style="color: #008000;">:</span><span style="color: #FF0000;">0</span>,
minChars<span style="color: #008000;">:</span><span style="color: #FF0000;">2</span>,
max<span style="color: #008000;">:</span><span style="color: #FF0000;">20</span>,
autoFill<span style="color: #008000;">:</span><span style="color: #0600FF;">false</span>,
extraParams<span style="color: #008000;">:</span> <span style="color: #000000;">&#123;</span>
    active <span style="color: #008000;">:</span> function<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> 
        <span style="color: #0600FF;">return</span> $<span style="color: #000000;">&#40;</span><span style="color: #666666;">'input[name=status]'</span><span style="color: #000000;">&#41;</span>.<span style="color: #008000;">is</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">':checked'</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> 
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Awesome! Thanks to Stack Overflow and <a href="http://stackoverflow.com/users/6440/redsquare">redsquare</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/09/08/jquery-autocomplete-extraparams-and-checkboxes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Add a ToolTip to the Telerik Ajax RadEditor</title>
		<link>http://blog.qumsieh.ca/2009/08/12/how-to-add-a-tooltip-to-the-telerik-ajax-radeditor/</link>
		<comments>http://blog.qumsieh.ca/2009/08/12/how-to-add-a-tooltip-to-the-telerik-ajax-radeditor/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 22:09:05 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Telerik]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=463</guid>
		<description><![CDATA[Ok this one was not immediately obvious to me so I&#8217;m posting the solution here. I&#8217;m using a Telerik Ajax RadEditor on my page as follows: &#60;telerik:RadEditor ID=&#34;rhfNotes&#34; EditModes=&#34;Preview&#34; runat=&#34;server&#34; ToolsFile=&#34;ToolsFile.xml&#34;&#62; &#60;/telerik:RadEditor&#62; Now, after doing a bit of inspection, I discovered there was a property I could set on the RadEditor called ToolTip that seemed [...]]]></description>
			<content:encoded><![CDATA[<p>Ok this one was not immediately obvious to me so I&#8217;m posting the solution here. I&#8217;m using a Telerik Ajax RadEditor on my page as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;</span>telerik<span style="color: #008000;">:</span>RadEditor ID<span style="color: #008000;">=</span><span style="color: #666666;">&quot;rhfNotes&quot;</span> EditModes<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Preview&quot;</span> runat<span style="color: #008000;">=</span><span style="color: #666666;">&quot;server&quot;</span> ToolsFile<span style="color: #008000;">=</span><span style="color: #666666;">&quot;ToolsFile.xml&quot;</span><span style="color: #008000;">&gt;</span>
<span style="color: #008000;">&lt;/</span>telerik<span style="color: #008000;">:</span>RadEditor<span style="color: #008000;">&gt;</span></pre></div></div>

<p>Now, after doing a bit of inspection, I discovered there was a property I could set on the RadEditor called <strong>ToolTip</strong> that seemed to just require a string value as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;</span>telerik<span style="color: #008000;">:</span>RadEditor ID<span style="color: #008000;">=</span><span style="color: #666666;">&quot;rhfNotes&quot;</span> EditModes<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Preview&quot;</span> runat<span style="color: #008000;">=</span><span style="color: #666666;">&quot;server&quot;</span> ToolTip<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Some message to the user&quot;</span> ToolsFile<span style="color: #008000;">=</span><span style="color: #666666;">&quot;ToolsFile.xml&quot;</span><span style="color: #008000;">&gt;</span>
<span style="color: #008000;">&lt;/</span>telerik<span style="color: #008000;">:</span>RadEditor<span style="color: #008000;">&gt;</span></pre></div></div>

<p>I assumed this would produce exactly what I needed. Unfortunately, after testing the above out, I got nothing, no tool tip. Doing a search on the forums turned up nothing useful, not even an explanation as to what the <strong>ToolTip</strong> property was really for. However, I did come across an entirely separate control in the <strong>Ajax</strong> suite of controls called <strong>RadToolTip</strong>.</p>
<p>That&#8217;s clever I thought, perhaps I&#8217;ll just give that a go. I was hoping there would be some sort of property I would set that would allow me to specify what control to tie this tool tip to. Guess what! There is! My final solution was as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;</span>telerik<span style="color: #008000;">:</span>RadToolTip ID<span style="color: #008000;">=</span><span style="color: #666666;">&quot;rttNotes&quot;</span> runat<span style="color: #008000;">=</span><span style="color: #666666;">&quot;server&quot;</span> TargetControlID<span style="color: #008000;">=</span><span style="color: #666666;">&quot;rhfNotes&quot;</span> Text<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Some message to user&quot;</span><span style="color: #008000;">&gt;&lt;/</span>telerik<span style="color: #008000;">:</span>RadToolTip<span style="color: #008000;">&gt;</span>
<span style="color: #008000;">&lt;</span>telerik<span style="color: #008000;">:</span>RadEditor ID<span style="color: #008000;">=</span><span style="color: #666666;">&quot;rhfNotes&quot;</span> EditModes<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Preview&quot;</span> runat<span style="color: #008000;">=</span><span style="color: #666666;">&quot;server&quot;</span> ToolsFile<span style="color: #008000;">=</span><span style="color: #666666;">&quot;ToolsFile.xml&quot;</span><span style="color: #008000;">&gt;</span>
<span style="color: #008000;">&lt;/</span>telerik<span style="color: #008000;">:</span>RadEditor<span style="color: #008000;">&gt;</span></pre></div></div>

<p>There you have it. I haven&#8217;t played around with all the properties and options I have available to me with the <strong>RadToolTip</strong>, but I&#8217;m sure there are some useful ones in there!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/08/12/how-to-add-a-tooltip-to-the-telerik-ajax-radeditor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DevTeach Slides and Files</title>
		<link>http://blog.qumsieh.ca/2009/06/10/devteach-slides-and-files/</link>
		<comments>http://blog.qumsieh.ca/2009/06/10/devteach-slides-and-files/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 15:48:27 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[DevTeach]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=447</guid>
		<description><![CDATA[Hi All, I wanted to thank everyone who attended by DevTeach session yesterday on integrating the telerik controls with your SharePoint Custom Solutions. I hope at the very least everyone walked away with something new they had learned or didn&#8217;t quite realize was possible before. If you&#8217;d like to view my slides again, there is [...]]]></description>
			<content:encoded><![CDATA[<p>Hi All, I wanted to thank everyone who attended by DevTeach session yesterday on integrating the telerik controls with your SharePoint Custom Solutions. I hope at the very least everyone walked away with something new they had learned or didn&#8217;t quite realize was possible before.</p>
<p>If you&#8217;d like to view my slides again, there is a pdf version available for download at <a href="http://www.slideshare.net/shereenqumsieh">slideshare.net/shereenqumsieh</a>.</p>
<p>As promised, I have uploaded the custom files I had created for the purposes of my demo. If you have any issues with using these, please let me know. <a href='http://blog.qumsieh.ca/wp-content/uploads/2009/06/custom.zip'>Download Here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/06/10/devteach-slides-and-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Party with Vancouver IT community Monday June 8th</title>
		<link>http://blog.qumsieh.ca/2009/06/02/party-with-vancouver-it-community-monday-june-8th/</link>
		<comments>http://blog.qumsieh.ca/2009/06/02/party-with-vancouver-it-community-monday-june-8th/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 23:57:21 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Telerik]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Events]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=444</guid>
		<description><![CDATA[The Vancouver IT community is hosting a DevTeach kick off party on Monday, June 8th. This is the official social event for DevTeach Vancouver so come socialize with us! The event is not just for the attendees of DevTeach Vancouver it&#8217;s a free event for everyone. It&#8217;s a unique chance for the attendees, speakers and [...]]]></description>
			<content:encoded><![CDATA[<p>The Vancouver IT community is hosting a DevTeach kick off party on Monday, June 8th. This is the official social event for DevTeach Vancouver so come socialize with us! The event is not just for the attendees of DevTeach Vancouver it&#8217;s a free event for everyone. It&#8217;s a unique chance for the attendees, speakers and locals to meet and talk over some free beer and pool. I&#8217;ll be there! The event will be held at the Soho location and you need to RSVP to attend.</p>
<p>To find out more visit this url: <a href="http://party.cuga.ca/Home.aspx">http://party.cuga.ca/Home.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/06/02/party-with-vancouver-it-community-monday-june-8th/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Speaking at DevTeach!</title>
		<link>http://blog.qumsieh.ca/2009/02/25/speaking-at-devteach-in-june/</link>
		<comments>http://blog.qumsieh.ca/2009/02/25/speaking-at-devteach-in-june/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 19:40:56 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Telerik]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=363</guid>
		<description><![CDATA[Greetings everyone! I am very excited to annouce that I have been selected to speak at the DevTeach conference that will be held here in Vancouver from June 8-12. I spend a great deal of time blogging about working with the Telerik web controls in my SharePoint development, so I figured this would be a good [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"><span style="text-decoration: underline;"><a href="http://www.devteach.com"></a><a href="http://devteach.com"><img class="alignnone size-full wp-image-370" title="vandevt-e" src="http://blog.qumsieh.ca/wp-content/uploads/2009/02/vandevt-e.jpg" alt="" width="500" height="81" /></a></span></p>
<p style="text-align: left;">Greetings everyone! I am very excited to annouce that I have been selected to speak at the <strong>DevTeach</strong> conference that will be held here in Vancouver from <strong><span style="color: #0000ff;">June 8-12</span></strong>. I spend a great deal of time blogging about working with the Telerik web controls in my SharePoint development, so I figured this would be a good opportunity to share some of the things I&#8217;ve learned and to demonstrate how easy it is to integrate these into your projects.</p>
<p style="text-align: left;">This is a great conference that promises to be the biggest developer, DBA and ITPro conference in Canada. It&#8217;s jam-packed with advanced sessions (level 300 and 400) all on the latest versions of Microsoft products and technologies. I encourage you all to at least check it out and see if some of the other sessions or topics might appeal to you.</p>
<p style="text-align: left;">Hope to see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/02/25/speaking-at-devteach-in-june/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validating a PeopleEditor Control on PostBack</title>
		<link>http://blog.qumsieh.ca/2009/02/12/validating-a-peopleeditor-control-on-postback/</link>
		<comments>http://blog.qumsieh.ca/2009/02/12/validating-a-peopleeditor-control-on-postback/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 18:54:59 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Object Model]]></category>
		<category><![CDATA[PeopleEditor]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=328</guid>
		<description><![CDATA[Let&#8217;s talk about validation and the PeopleEditor control. There doesn&#8217;t seem to be a consensus on how this is supposed to be done so I&#8217;ll outline my findings and what eventually worked for me. I&#8217;ll start by explaining what I was attempting to do. I have a PeopleEditor control on a custom application page. My [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s talk about validation and the <strong>PeopleEditor</strong> control. There doesn&#8217;t seem to be a consensus on how this is supposed to be done so I&#8217;ll outline my findings and what eventually worked for me.</p>
<p>I&#8217;ll start by explaining what I was attempting to do. I have a <strong>PeopleEditor</strong> control on a custom application page. My custom application page is located in the <strong>_layouts</strong> directory. On this page, I also have a submit button that saves my data to a SharePoint list upon submit.</p>
<p>Now, I need to ensure before submit, that the PeopleEditor control contains a valid entry. Blank and invalid values are not permitted.</p>
<p>I first attempted to set the <strong>AlllowEmpty</strong> property to <strong>false</strong>. However, that didn&#8217;t seem to help. If I clicked submit, the page would post back and then the control would display an error once the page reloaded. At this point, it was too late to be informing the user that there was a problem with their entry, the page had already posted back, so this was not useful.</p>
<p>I also tried setting the <strong>ValidationEnabled</strong> property to <strong>true</strong>. That didn&#8217;t seem to make any difference either. I am confused as to how these two properties are supposed to work.</p>
<p>My next attempt was to add an ASP.NET required field validator to the page as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;</span>wssawc<span style="color: #008000;">:</span>PeopleEditor AllowEmpty<span style="color: #008000;">=</span><span style="color: #666666;">&quot;false&quot;</span> ValidatorEnabled<span style="color: #008000;">=</span><span style="color: #666666;">&quot;true&quot;</span> Width<span style="color: #008000;">=</span><span style="color: #666666;">&quot;250px&quot;</span> ID<span style="color: #008000;">=</span><span style="color: #666666;">&quot;pePR&quot;</span> runat<span style="color: #008000;">=</span><span style="color: #666666;">&quot;server&quot;</span> SelectionSet<span style="color: #008000;">=</span><span style="color: #666666;">&quot;User&quot;</span> MultiSelect<span style="color: #008000;">=</span><span style="color: #666666;">&quot;false&quot;</span> <span style="color: #008000;">/&gt;</span>
&nbsp;
<span style="color: #008000;">&lt;</span>asp<span style="color: #008000;">:</span>RequiredFieldValidator ID<span style="color: #008000;">=</span><span style="color: #666666;">&quot;rfvPR&quot;</span> ControlToValidate<span style="color: #008000;">=</span><span style="color: #666666;">&quot;pePR&quot;</span> runat<span style="color: #008000;">=</span><span style="color: #666666;">&quot;server&quot;</span> ErrorMessage<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Project Requestor (Cannot be blank)&quot;</span> Text<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Cannot be blank.&quot;</span> ValidationGroup<span style="color: #008000;">=</span><span style="color: #666666;">&quot;SubmitForm&quot;</span> Display<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Dynamic&quot;</span><span style="color: #008000;">&gt;&lt;/</span>asp<span style="color: #008000;">:</span>RequiredFieldValidator<span style="color: #008000;">&gt;</span></pre></td></tr></table></div>

<p>This took care of the client side validation that prevented the user from clicking submit without first entering a value into the control.</p>
<p>However, this did not handle the scenario when a user entered an invalid value in the control and hit submit. In this case, the form will attempt to submit and create the item, but will fail to save the value to the list item field because the value was invalid. An example of an invalid value would be bad data in that field.</p>
<p>To fix this, in my submit method, I added an <strong>IF</strong> statement to check how many resolved entities there were.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>pePR.<span style="color: #0000FF;">ResolvedEntities</span>.<span style="color: #0000FF;">Count</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// continue with the submit</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">else</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// output an error that the user did not enter a valid user</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>If anyone has any feedback, or has had success using the <strong>AllowEmpty</strong> property, please comment on this post or drop me a note. I&#8217;m interested in hearing how others were able to get around this issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/02/12/validating-a-peopleeditor-control-on-postback/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

