<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-6262810033751140470</atom:id><lastBuildDate>Tue, 03 Nov 2009 12:17:33 +0000</lastBuildDate><title>Prajeesh's Tech blog</title><description>Code snippets and programming help</description><link>http://prajeeshkk.blogspot.com/</link><managingEditor>noreply@blogger.com (prajeesh)</managingEditor><generator>Blogger</generator><openSearch:totalResults>64</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/PrajeeshsTechBlog" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-5611327428309973102</guid><pubDate>Tue, 03 Nov 2009 11:02:00 +0000</pubDate><atom:updated>2009-11-03T04:17:33.820-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">Grid View</category><title>Creating a Nested Gridview Control</title><description>&lt;span style="font-weight: bold;"&gt;Working with Gridview inside Gridview&lt;/span&gt;.
&lt;br /&gt;
&lt;br /&gt;Grid view is a very useful and  easier to use data presentation control in asp.net it is having lots of default features that we can set very easily, but in some of the projects you may need to show a master client relationship to the users For eg:- List of students who are studying in different departments.
&lt;br /&gt;We can handle this situation by using nested grid views, ie a Gridview inside a Gridview.
&lt;br /&gt;Microsoft is providing a solution for this situation msdn website , see the link : &lt;a href="http://msdn.microsoft.com/en-us/library/aa992038%28VS.80%29.aspx"&gt;http://msdn.microsoft.com/en-us/library/aa992038(VS.80).aspx&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;I think Microsoft's solution contains lot of steps to complete the process, I done a workaround on this and come up with a solution, let me explain the tasks in step by step with an example.
&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 1&lt;/span&gt;:
&lt;br /&gt;Create a gridview named gvDepartments and add a Template Field in it.
&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 2:
&lt;br /&gt;&lt;/span&gt;Inside the Template Field'd Item Template add another gridview called gvStudents.
&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 3:
&lt;br /&gt;&lt;/span&gt;Add following code in gvStudents grid view
&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;DataSource ='&lt;%# GetStudentInfo( Convert.ToInt16(Eval("Department_Id")) ) %&gt;'&lt;/span&gt;
&lt;br /&gt;Where GetStudentInfo is a server side function that returns a datatable containing the list of students based on department id.
&lt;br /&gt;Source of the Grid views will be like below code :
&lt;br /&gt;&lt;pre name="code" class="c-sharp"&gt;
&lt;br /&gt;   &lt;asp:GridView ID="gvDepartments" runat="server" AutoGenerateColumns="False"
&lt;br /&gt;            DataKeyNames="DepartMent_Id" CellPadding="4" ForeColor="Black"
&lt;br /&gt;            GridLines="Vertical" BackColor="White" BorderColor="#DEDFDE"
&lt;br /&gt;            BorderStyle="None" BorderWidth="1px"&gt;
&lt;br /&gt;            &lt;rowstyle backcolor="#F7F7DE"&gt;
&lt;br /&gt;            &lt;columns&gt;
&lt;br /&gt;                &lt;asp:templatefield headertext="#No"&gt;
&lt;br /&gt;                &lt;itemtemplate&gt;
&lt;br /&gt;                &lt;%# Container.DataItemIndex+1   %&gt;
&lt;br /&gt;                &lt;/itemtemplate&gt;
&lt;br /&gt;                &lt;/asp:TemplateField&gt;
&lt;br /&gt;                &lt;asp:boundfield datafield="Department_Name" headertext="Dep Name"&gt;
&lt;br /&gt;                &lt;asp:templatefield headertext="Students"&gt;
&lt;br /&gt;                    &lt;itemtemplate&gt;
&lt;br /&gt;                        &lt;asp:GridView ID="gvStudents" runat="server"
&lt;br /&gt;                            DataSource ='&lt;%# GetStudentInfo( Convert.ToInt16(Eval("Department_Id")) ) %&gt;'
&lt;br /&gt;                            CellPadding="4" ForeColor="#333333" GridLines="None" ShowHeader="False"
&lt;br /&gt;                            AutoGenerateColumns="False"&gt;
&lt;br /&gt;                            &lt;rowstyle backcolor="#F7F6F3" forecolor="#333333"&gt;
&lt;br /&gt;                            &lt;columns&gt;
&lt;br /&gt;                                &lt;asp:templatefield headertext="#No"&gt;
&lt;br /&gt;                                    &lt;itemtemplate&gt;
&lt;br /&gt;                                       &lt;%# Container.DataItemIndex +1   %&gt;
&lt;br /&gt;                                    &lt;/itemtemplate&gt;
&lt;br /&gt;                                &lt;/asp:TemplateField&gt;
&lt;br /&gt;                                &lt;asp:boundfield datafield="Student_Name"&gt;
&lt;br /&gt;                            &lt;/columns&gt;
&lt;br /&gt;                            &lt;footerstyle backcolor="#5D7B9D" bold="True" forecolor="White"&gt;
&lt;br /&gt;                            &lt;pagerstyle backcolor="#284775" forecolor="White" horizontalalign="Center"&gt;
&lt;br /&gt;                            &lt;selectedrowstyle backcolor="#E2DED6" bold="True" forecolor="#333333"&gt;
&lt;br /&gt;                            &lt;headerstyle backcolor="#5D7B9D" bold="True" forecolor="White"&gt;
&lt;br /&gt;                            &lt;editrowstyle backcolor="#999999"&gt;
&lt;br /&gt;                            &lt;alternatingrowstyle backcolor="White" forecolor="#284775"&gt;
&lt;br /&gt;                        &lt;/asp:GridView&gt;
&lt;br /&gt;                    &lt;/itemtemplate&gt;
&lt;br /&gt;                &lt;/asp:TemplateField&gt;
&lt;br /&gt;            &lt;/columns&gt;
&lt;br /&gt;            &lt;footerstyle backcolor="#CCCC99"&gt;
&lt;br /&gt;            &lt;pagerstyle backcolor="#F7F7DE" forecolor="Black" horizontalalign="Right"&gt;
&lt;br /&gt;            &lt;selectedrowstyle backcolor="#CE5D5A" bold="True" forecolor="White"&gt;
&lt;br /&gt;            &lt;headerstyle backcolor="#6B696B" bold="True" forecolor="White"&gt;
&lt;br /&gt;            &lt;alternatingrowstyle backcolor="White"&gt;
&lt;br /&gt;        &lt;/asp:GridView&gt;
&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 4&lt;/span&gt;
&lt;br /&gt;Create Method to bind gvDepartments (Must contain a column named “Department_Id” as we are passing this parameter to bind  gvStudents).
&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 5&lt;/span&gt;
&lt;br /&gt;Create a Method named  GetStudentInfo(int department_Id) , It accepts Department_Id as parameter and returns a
&lt;br /&gt;datatable contains students list,(example given below) and  you are done.
&lt;br /&gt;&lt;pre name="code" class="c-sharp"&gt;
&lt;br /&gt;public DataTable StudentsByDepartment(int DepartmentId)
&lt;br /&gt;   {
&lt;br /&gt;       SqlConnection dbConnection = new SqlConnection(ConnectionString);
&lt;br /&gt;       DataTable dtStudentList = new DataTable();
&lt;br /&gt;       try
&lt;br /&gt;       {
&lt;br /&gt;           dbConnection.Open();
&lt;br /&gt;           SqlDataAdapter daStudents = new SqlDataAdapter();
&lt;br /&gt;           SqlCommand cmdSelect = new SqlCommand("SelectStudentByDep",dbConnection);
&lt;br /&gt;           cmdSelect.CommandType = CommandType.StoredProcedure;
&lt;br /&gt;           cmdSelect.Parameters.AddWithValue("@Dep", DepartmentId );
&lt;br /&gt;           daStudents.SelectCommand = cmdSelect;
&lt;br /&gt;           daStudents.Fill(dtStudentList);
&lt;br /&gt;       }
&lt;br /&gt;       catch (Exception objException)
&lt;br /&gt;       {
&lt;br /&gt;           HttpContext.Current.Response.Write(objException.Message);
&lt;br /&gt;       }
&lt;br /&gt;       finally
&lt;br /&gt;       {
&lt;br /&gt;           if (dbConnection != null &amp;amp;&amp;amp; dbConnection.State == ConnectionState.Open)
&lt;br /&gt;           {
&lt;br /&gt;               dbConnection.Close();
&lt;br /&gt;           }
&lt;br /&gt;       }
&lt;br /&gt;       return dtStudentList;
&lt;br /&gt;   }
&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;Figure: Sample output of a nested Gridview :
&lt;br /&gt;&lt;pre&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_pQOQ7ijheuo/SvAQKlE8ZNI/AAAAAAAAAOc/KeokXXaOLps/s1600-h/gridview-inside-gridview.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 291px; height: 244px;" src="http://1.bp.blogspot.com/_pQOQ7ijheuo/SvAQKlE8ZNI/AAAAAAAAAOc/KeokXXaOLps/s320/gridview-inside-gridview.JPG" alt="" id="BLOGGER_PHOTO_ID_5399833727154808018" border="0" /&gt;&lt;/a&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-5611327428309973102?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/Cje7S8iItT8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/Cje7S8iItT8/creating-nested-gridview-control.html</link><author>noreply@blogger.com (prajeesh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_pQOQ7ijheuo/SvAQKlE8ZNI/AAAAAAAAAOc/KeokXXaOLps/s72-c/gridview-inside-gridview.JPG" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/11/creating-nested-gridview-control.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-5824788155116410512</guid><pubDate>Thu, 29 Oct 2009 12:43:00 +0000</pubDate><atom:updated>2009-11-02T04:05:15.218-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><title>Maintaining scrollbar position after postback in an asp.net page</title><description>In some situations we may need to maintain the scroll bar position when we are dealing with large pages with a button causes post back, you can use achieve this by adding &lt;span style="font-weight: bold;"&gt;MaintainScrollPositionOnPostback=”true” &lt;/span&gt;in @Page directive.&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;&lt;br /&gt;&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MaintainScrollPositionOnPostback ="true"  %&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-5824788155116410512?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/aPhPuErRjkY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/aPhPuErRjkY/maintaining-scrollbar-position-after.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/10/maintaining-scrollbar-position-after.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-7669131612432058279</guid><pubDate>Thu, 29 Oct 2009 05:29:00 +0000</pubDate><atom:updated>2009-10-28T23:34:58.557-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">Regule expressions</category><title>some commonly used reguler expressions</title><description>Here is the list of some commonly used reguler expressions for validating your forms.&lt;strong&gt; &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;E-mail&lt;/strong&gt;&lt;br /&gt;^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$&lt;br /&gt;&lt;strong&gt;URL&lt;/strong&gt;&lt;br /&gt;^(htf)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;amp;%\$#_]*)?$&lt;br /&gt;&lt;strong&gt;Social Security Number&lt;/strong&gt;&lt;br /&gt;^\d{3}-\d{2}-\d{4}$&lt;br /&gt;&lt;strong&gt;Phone number&lt;/strong&gt;(Validates US Phone number)&lt;br /&gt;^[01]?[- .]?(\([2-9]\d{2}\)[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$&lt;br /&gt;&lt;strong&gt;Zip Code&lt;/strong&gt;(Validates US Zip code)&lt;br /&gt;^(\d{5}-\d{4}\d{5}\d{9})$^([a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d)$&lt;br /&gt;&lt;strong&gt;Currency(Non Negative)&lt;/strong&gt;&lt;br /&gt;^\d+(\.\d\d)?$&lt;br /&gt;&lt;strong&gt;Currency(+ve or -ve)&lt;/strong&gt;&lt;br /&gt;^(-)?\d+(\.\d\d)?$&lt;br /&gt;&lt;strong&gt;Non Negative Integer&lt;/strong&gt;&lt;br /&gt;^\d+$&lt;br /&gt;For a detailed article on reguler expressions, refer : &lt;a href="http://msdn.microsoft.com/en-us/library/ms972966.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms972966.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-7669131612432058279?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/_YxNJu9cTkw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/_YxNJu9cTkw/some-commonly-used-reguler-expressions.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/10/some-commonly-used-reguler-expressions.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-8218707258085250577</guid><pubDate>Fri, 25 Sep 2009 11:17:00 +0000</pubDate><atom:updated>2009-09-25T06:05:54.008-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">Twitter</category><title>How to display latest tweet in your website using Javascript and twitter API</title><description>Sometimes you may be want to show your latest twitter tweets in your website or blog, most of the cases you are doing this by using widgets with limited customization facilities and showing ads or links to other websites, here is an easier way to achieve this using twitter API and javascript.&lt;br /&gt;Step 1:&lt;textarea name="code" class="c#"&gt;&lt;br /&gt;&lt;div id="twitter_update_list"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/textarea&gt;&lt;br /&gt;First, decide where about on your page you want your last tweet to display. Then paste following html code there.&lt;br /&gt;Step 2:&lt;br /&gt;Next you need to put these 2 lines of JavaScript below the code in step 1. On the 2nd line of code where it says&lt;span style="font-weight: bold;"&gt; prajeeshkk.json&lt;/span&gt;, you need to replace&lt;span style="font-weight: bold;"&gt; prajeeshkk &lt;/span&gt; with your twitter username.&lt;br /&gt;&lt;textarea name="code" class="c#"&gt;&lt;br /&gt;&lt;script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript" src="http://twitter.com/statuses/user_timeline/prajeeshkk.json?callback=twitterCallback2&amp;amp;count=1"&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;/textarea&gt;&lt;br /&gt;Step 3:(Optional)&lt;br /&gt;You can apply css and make the div displaying the tweet stylish.&lt;br /&gt;&lt;textarea name="code" class="c#"&gt;&lt;br /&gt;#twitter_update_list li {&lt;br /&gt;list-style-type: none;&lt;br /&gt;}&lt;br /&gt;#twitter_update_list span a&lt;br /&gt;{&lt;br /&gt;display: inline;&lt;br /&gt;color: #008080;&lt;br /&gt;}&lt;br /&gt;#twitter_update_list span a:hover&lt;br /&gt;{&lt;br /&gt;text-decoration: underline;&lt;br /&gt;color: #66CCFF;&lt;br /&gt;}&lt;br /&gt;#twitter_update_list span&lt;br /&gt;{&lt;br /&gt;color: #000000;&lt;br /&gt;background: white;&lt;br /&gt;}&lt;br /&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;See how my tweet design looks :&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_pQOQ7ijheuo/SryuDU4FKAI/AAAAAAAAAN4/6U0HnFnHLFQ/s1600-h/tweet.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 198px; height: 168px;" src="http://1.bp.blogspot.com/_pQOQ7ijheuo/SryuDU4FKAI/AAAAAAAAAN4/6U0HnFnHLFQ/s320/tweet.jpg" alt="" id="BLOGGER_PHOTO_ID_5385370626595039234" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-8218707258085250577?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/C2APpqj_2nc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/C2APpqj_2nc/how-to-display-your-latest-tweet-in.html</link><author>noreply@blogger.com (prajeesh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_pQOQ7ijheuo/SryuDU4FKAI/AAAAAAAAAN4/6U0HnFnHLFQ/s72-c/tweet.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/09/how-to-display-your-latest-tweet-in.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-9051553737628588552</guid><pubDate>Wed, 23 Sep 2009 11:06:00 +0000</pubDate><atom:updated>2009-09-23T04:28:28.954-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><title>Resetting all controls in an asp.net form</title><description>In some applications we may need to reset all controls in using a single "Reset" button click, here is the c# code to achieve this.&lt;br /&gt;&lt;pre name=code class="c-sharp"&gt;&lt;br /&gt;  public  static void ResetControls(ControlCollection pagecontrols, bool txtbox, bool dropdownlist, bool label)&lt;br /&gt;    {&lt;br /&gt;        foreach (Control cntrl in pagecontrols)&lt;br /&gt;        {&lt;br /&gt;            foreach (Control mycontrols in cntrl.Controls)&lt;br /&gt;            {&lt;br /&gt;                if (txtbox)&lt;br /&gt;                {&lt;br /&gt;                    if (mycontrols is TextBox)&lt;br /&gt;                    {&lt;br /&gt;                        (mycontrols as TextBox).Text = string.Empty;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;                if (dropdownlist)&lt;br /&gt;                {&lt;br /&gt;                    if (mycontrols is DropDownList)&lt;br /&gt;                    {&lt;br /&gt;                        (mycontrols as DropDownList).SelectedIndex = 0;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;                if (label)&lt;br /&gt;                {&lt;br /&gt;                    if (mycontrols is Label)&lt;br /&gt;                    {&lt;br /&gt;                        (mycontrols as Label).Text = string.Empty;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We can call this function using following format if you want to clear all controls except label&lt;br /&gt;&lt;pre name="code" class="c-sharp"&gt;&lt;br /&gt;FormControl.ResetControls(this.Controls, true, true, false);&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-9051553737628588552?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/2IlHSx4WNBM" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/2IlHSx4WNBM/resetting-all-controls-in-aspnet-form.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/09/resetting-all-controls-in-aspnet-form.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-6676610490629385105</guid><pubDate>Fri, 18 Sep 2009 15:54:00 +0000</pubDate><atom:updated>2009-09-18T09:08:25.901-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><title>SQL Query to sort stored procedure on Modified date or Created Date</title><description>Sometimes you may need to update an online database with some stored procedure you have modified in your local system, but in most of the cases you may be confused about what are the stored procedures or tables you modified last, here is a quick solution for this.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;1.Query to sort Stored Procedures on modified date.&lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="c-sharp"&gt;&lt;br /&gt;SELECT name, create_date, modify_date,type &lt;br /&gt;FROM sys.objects&lt;br /&gt;WHERE type = 'P' order by modify_date  desc&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;2.Query to sort Stored Procedures on created date&lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="c-sharp"&gt;&lt;br /&gt;SELECT name, create_date, modify_date,type &lt;br /&gt;FROM sys.objects&lt;br /&gt;WHERE type = 'P' order by create_date  desc&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;3.Query to sort user defined tables on created date&lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="c-sharp"&gt;&lt;br /&gt;SELECT name, create_date, modify_date,type &lt;br /&gt;FROM sys.objects&lt;br /&gt;WHERE type = 'u' order by create_date  desc&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;4.Query to sort user defined tables on modified date&lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="c-sharp"&gt;&lt;br /&gt;SELECT name, create_date, modify_date,type &lt;br /&gt;FROM sys.objects&lt;br /&gt;WHERE type = 'u' order by modify_date  desc&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-6676610490629385105?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/firUNyAaCnA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/firUNyAaCnA/sql-query-to-sort-stored-procedure-on.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/09/sql-query-to-sort-stored-procedure-on.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-2928910294358731477</guid><pubDate>Tue, 04 Aug 2009 19:55:00 +0000</pubDate><atom:updated>2009-08-04T13:26:34.037-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">web development</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">web design</category><title>Scrolling page title using javascript</title><description>In some websites you may seen animating or scrolling page titles, here is the trick to do this, just place below code between your page's &amp;lt;head&amp;gt; and &amp;lt;/head&amp;gt; tags&lt;br /&gt;&lt;textarea name="code" class="c#" cols="60" rows="13"&gt;&lt;br /&gt;&lt;script language="javascript"&gt; var msg = " This is a test animating title ";&lt;br /&gt;var pos = 0;var spacer = " ....";&lt;br /&gt;var time_length = 200;&lt;br /&gt;function RunTitle()&lt;br /&gt;{ &lt;br /&gt;document.title = msg.substring(pos, msg.length) + spacer + msg.substring(0, pos); pos++; &lt;br /&gt;if (pos &gt; msg.length) pos=0;&lt;br /&gt; window.setTimeout("RunTitle()",time_length);&lt;br /&gt;}RunTitle();&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;/textarea&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-2928910294358731477?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/TOmt72qaoDc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/TOmt72qaoDc/animating-page-title-using-javascript.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/08/animating-page-title-using-javascript.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-1918442263628486597</guid><pubDate>Tue, 04 Aug 2009 18:01:00 +0000</pubDate><atom:updated>2009-08-04T12:42:18.679-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><title>Automatic page refresh using asp.net</title><description>Some situations such as a freequently updating page you may need to refresh your page automatically, here is the code to achieve this.&lt;br /&gt;&lt;pre class="c-sharp" name="code"&gt;&lt;br /&gt;Response.AppendHeader("Refresh", "60; URL=Default.aspx");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here your page Default.aspx will be refreshed after 60 seconds, if you want to redirect to another page after a few seconds, replace the page 'Default.aspx' with the page you want to be redirected.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-1918442263628486597?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/ll4ljNSU9Qg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/ll4ljNSU9Qg/automatic-page-refresh-in-using-aspnet.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/08/automatic-page-refresh-in-using-aspnet.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-526484873296672058</guid><pubDate>Thu, 16 Jul 2009 12:20:00 +0000</pubDate><atom:updated>2009-07-16T05:29:41.135-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">Data Base</category><title>SQL Query to Delete all stored procedures in a database</title><description>Here is the SQL query to create a stored procedure that deletes all stored procedures in a database&lt;br /&gt;&lt;pre class="c-sharp" name="code"&gt;&lt;br /&gt;&lt;br /&gt;create procedure dropallsp as&lt;br /&gt;declare @procName varchar(500)&lt;br /&gt;declare cur cursor&lt;br /&gt;for Select [name] from sys.procedures where [type] = 'P' and is_ms_shipped = 0 and [name] not like 'sp[_]%diagram%'&lt;br /&gt;open cur&lt;br /&gt;fetch next from cur into @procName&lt;br /&gt;while @@fetch_status = 0&lt;br /&gt;begin&lt;br /&gt;exec('drop procedure ' + @procName)&lt;br /&gt;fetch next from cur into @procName&lt;br /&gt;end&lt;br /&gt;close cur&lt;br /&gt;deallocate cur&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-526484873296672058?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/XTuC2vEDeFg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/XTuC2vEDeFg/query-to-delete-all-stored-procedures.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/07/query-to-delete-all-stored-procedures.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-3880538313398427142</guid><pubDate>Thu, 16 Jul 2009 12:13:00 +0000</pubDate><atom:updated>2009-07-16T05:19:58.721-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">Data Base</category><title>Query to drop all tables in a database</title><description>Here is an easy way to drop all tables in a database using a single query.&lt;br /&gt;&lt;pre name="code" class="c-sharp"&gt;&lt;br /&gt;exec sp_msforeachtable 'Drop table ?'&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;As it is an undocumented stored procedure it may be get removed any time without any notification.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-3880538313398427142?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/tobDqEY6fuE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/tobDqEY6fuE/query-to-drop-all-tables-in-database.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/07/query-to-drop-all-tables-in-database.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-8958199751360407160</guid><pubDate>Thu, 09 Jul 2009 21:05:00 +0000</pubDate><atom:updated>2009-07-09T14:20:24.901-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Microsoft</category><title>Microsoft Launched new community portal for developers</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.microsoft.com/click/thrivedev/"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 264px;" src="http://4.bp.blogspot.com/_pQOQ7ijheuo/SlZdNVSeSuI/AAAAAAAAANM/FL9aEzlnM3Q/s400/Microsoft-Thrive.jpg" alt="" id="BLOGGER_PHOTO_ID_5356571290438093538" border="0" /&gt;&lt;/a&gt;Microsoft Launched a new community portal for developers to thrive your career, this portal helps you to find a job, training, trial software's and community support for developers.&lt;br /&gt;URL is : &lt;a href="http://www.microsoft.com/click/thrivedev/"&gt;http://www.microsoft.com/click/thrivedev/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-8958199751360407160?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/1pxt-fpG-TI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/1pxt-fpG-TI/microsoft-launched-new-community-portal.html</link><author>noreply@blogger.com (prajeesh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_pQOQ7ijheuo/SlZdNVSeSuI/AAAAAAAAANM/FL9aEzlnM3Q/s72-c/Microsoft-Thrive.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/07/microsoft-launched-new-community-portal.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-5494311749794637694</guid><pubDate>Thu, 09 Jul 2009 20:24:00 +0000</pubDate><atom:updated>2009-07-09T13:44:51.675-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">HTML</category><title>Page redirection using javacript and HTML</title><description>In ASP.net we are using &lt;span style="font-weight: bold;"&gt;Response.Redirect&lt;/span&gt; or &lt;span style="font-weight: bold;"&gt;Server.Transfer&lt;/span&gt; for redirect to another page, this Redirection can also be done using &lt;span style="font-weight: bold;"&gt;Javascript  &lt;/span&gt;or &lt;span style="font-weight: bold;"&gt;HTML&lt;/span&gt;&lt;br /&gt;javascript:&lt;br /&gt;&lt;pre name="code" class="javascript"&gt;&lt;br /&gt; &lt; language="javascript"&gt;&lt;br /&gt;         window.location = "YourURL.aspx";&lt;br /&gt;  &lt; /script &gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Plain HTML(you can add following code between your &amp;lt;head&amp;gt; and &amp;lt;/head&amp;gt; tags):&lt;br /&gt;&lt;pre name="code" class="html"&gt;&lt;br /&gt; &lt; equiv="REFRESH" content="0;url=yourURL.aspx"&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-5494311749794637694?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/1IE669CRjIk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/1IE669CRjIk/page-redirection-using-javacript-and.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/07/page-redirection-using-javacript-and.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-3023183887841877264</guid><pubDate>Thu, 09 Jul 2009 19:47:00 +0000</pubDate><atom:updated>2009-07-09T13:23:23.895-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><title>Difference between Response.redirect and Server.Transfer</title><description>In ASP.net we are redirecting to a page using &lt;span style="font-weight: bold;"&gt;Response.Redirect("PageName.aspx") ;  &lt;/span&gt;&lt;span&gt;or&lt;br /&gt;using &lt;span style="font-weight: bold;"&gt;Server.Transfer("PageName.aspx"); &lt;/span&gt;difference between these two commands are&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Response.Redirect&lt;/span&gt; tells browser to redirect to another page where &lt;span style="font-weight: bold;"&gt;Server.Transfer &lt;/span&gt;instead of telling the browser it changes the focus of the web server to another page so it reduces HTTP requests and run your application faster also browser url will be same, please note that&lt;span style="font-weight: bold;"&gt; Server.Transfer &lt;/span&gt;can only used for redirection between the sites running in same server.&lt;br /&gt;If you set &lt;span style="font-weight: bold;"&gt;PreserveForm &lt;/span&gt;parameter True then existing query strings and form values are available in next page too.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-3023183887841877264?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/XP9TZKm92mM" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/XP9TZKm92mM/difference-between-responseredirect-and.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/07/difference-between-responseredirect-and.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-3274689189243046345</guid><pubDate>Mon, 06 Jul 2009 20:29:00 +0000</pubDate><atom:updated>2009-07-06T14:13:34.006-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">Paypal</category><category domain="http://www.blogger.com/atom/ns#">HTML</category><title>Asp.net Pay pal form posting problem</title><description>Me and my colleague Anurag were trying  to integrate a Paypal button in one of our recent project, we copied the button code available from Paypal website to our ASP.NET page and it was not worked and button click results only in a postback, at last we realized that it wont work as button code contained a form and ASP.net will not support more than one form in a page.&lt;br /&gt;The button code we got from Paypal was like below:&lt;br /&gt;&lt;pre name="code" class="html"&gt;&lt;br /&gt;&lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post"&gt;&lt;br /&gt;&lt;input type="hidden" name="cmd" value="_s-xclick"&gt;&lt;br /&gt;&lt;input type="hidden" name="hosted_button_id" value="xxxxxx"&gt;&lt;br /&gt;&lt;input type="image" src="http://www.Mywebsiteurl.com/images/pay.jpg" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."&gt;&lt;br /&gt;&lt;img alt="" border="0" src="https://www.paypal.com/en_AU/i/scr/pixel.gif" width="1" height="1"&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We googled a lot to overcome this situation and finally we got a quick solution from &lt;a href="http://www.chyke.com/post/2008/02/ASPnet-Paypal-button-HTML-Form-Post-Issues.aspx"&gt;Chyake Uchaya's blog&lt;/a&gt;, but the solution was not worked well in Mozilla, we done minor changes  in the code and it worked perfectly finally, here is the code:&lt;br /&gt;&lt;pre name="code" class="html"&gt;&lt;br /&gt;&lt;input type="hidden" name="cmd" value="_s-xclick"&gt;&lt;br /&gt;&lt;input type="hidden" name="hosted_button_id" value="xxxxxx"&gt;&lt;br /&gt;&lt;asp:ImageButton ID="ImageButton1" ImageUrl="https://www.paypal.com/en_AU/i/scr/pixel.gif" runat="server" OnClientClick="document.getElementById('aspnetForm').action='https://www.paypal.com/cgi-bin/webscr';"/&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;if you are not using Master pages, you can replace getElementById('aspnetForm') with getElementById('form1') or the form name you are using.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-3274689189243046345?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/U50YyvtuBOk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/U50YyvtuBOk/aspnet-pay-pal-form-posting-problem.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/07/aspnet-pay-pal-form-posting-problem.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-2205054339826860649</guid><pubDate>Sun, 05 Jul 2009 10:00:00 +0000</pubDate><atom:updated>2009-07-05T03:54:24.524-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Windows</category><category domain="http://www.blogger.com/atom/ns#">Microsoft</category><title>Windows 7 Upgrade option and pricing announced</title><description>&lt;a href="http://4.bp.blogspot.com/_pQOQ7ijheuo/SlCGLMNNNLI/AAAAAAAAALo/bpo22nMos1I/s1600-h/windows-7.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 220px;" src="http://4.bp.blogspot.com/_pQOQ7ijheuo/SlCGLMNNNLI/AAAAAAAAALo/bpo22nMos1I/s400/windows-7.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5354927483756819634" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Microsoft corporation announces Windows 7 pricing and upgrade option program.&lt;br /&gt;&lt;strong&gt;So here’s the low-down on pricing for Windows 7. The estimated retail prices for upgrade packaged retail product of Windows 7 in the U.S. are:&lt;br /&gt;&lt;/strong&gt;Windows 7 Home Premium (Upgrade): $119.99&lt;br /&gt;Windows 7 Professional (Upgrade): $199.99&lt;br /&gt;Windows 7 Ultimate (Upgrade): $219.99&lt;br /&gt;&lt;strong&gt;And the estimated retail prices for full packaged retail product of Windows 7 in the U.S. are:&lt;br /&gt;&lt;/strong&gt;Windows 7 Home Premium (Full): $199.99&lt;br /&gt;Windows 7 Professional (Full): $299.99&lt;br /&gt; Windows 7 Ultimate (Full): $319.99&lt;br /&gt;This means that Windows 7 Home Premium full retail product is $40.00 less than Windows Vista Home Premium today.&lt;br /&gt;&lt;br /&gt;Read full story &lt;a href="http://windowsteamblog.com/blogs/windows7/archive/2009/06/25/announcing-the-windows-7-upgrade-option-program-amp-windows-7-pricing-bring-on-ga.aspx"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-2205054339826860649?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/hTp6lV23PwY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/hTp6lV23PwY/windows-7-upgrade-option-and-pricing.html</link><author>noreply@blogger.com (prajeesh)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_pQOQ7ijheuo/SlCGLMNNNLI/AAAAAAAAALo/bpo22nMos1I/s72-c/windows-7.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/07/windows-7-upgrade-option-and-pricing.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-2679827930432198170</guid><pubDate>Sun, 05 Jul 2009 07:52:00 +0000</pubDate><atom:updated>2009-07-06T12:55:34.428-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Image</category><title>Image Resizing while uploading using asp.net</title><description>Many asp.net communities and discussion forums are flooded with questions on how to resize images while uploading or how to generate image thumbnails while uploading an image, i have seen many posts giving the solution, here i am going to combine some solutions and created a simple solution.&lt;br /&gt;Another feature of this solution is you can upload any number of images at a time.&lt;br /&gt;Here is the code:&lt;br /&gt;&lt;pre name="code" class="c-sharp"&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Drawing;&lt;br /&gt;using System.Drawing.Drawing2D;&lt;br /&gt;using System.Drawing.Imaging;&lt;br /&gt;using System.IO;&lt;br /&gt;/// &lt;summary&gt;&lt;br /&gt;/// Summary description for clsImageUpload : Credits : http://prajeeshkk.blogspot.com&lt;br /&gt;/// &lt;/summary&gt;&lt;br /&gt;public class clsImageUpload&lt;br /&gt;{&lt;br /&gt;string fileName;&lt;br /&gt;public clsImageUpload()&lt;br /&gt;{&lt;br /&gt;//&lt;br /&gt;// TODO: Add constructor logic here&lt;br /&gt;//&lt;br /&gt;}&lt;br /&gt;//This function is called from aspnet page, it takes directory name as parameter&lt;br /&gt;public string HandleUploadedFile(string directory)&lt;br /&gt;{&lt;br /&gt;// To get the root of the web site&lt;br /&gt;string root = HttpContext.Current.Server.MapPath("~/");&lt;br /&gt;// clean up the path&lt;br /&gt;if (!root.EndsWith(@"\"))&lt;br /&gt;root += @"\";&lt;br /&gt;// make a folder to store the images in&lt;br /&gt;string fileDirectory = root + @"\" + directory + "\\";&lt;br /&gt;// create the folder if it does not exist&lt;br /&gt;// make a link to the new file&lt;br /&gt;&lt;br /&gt;// loop through the file in the request&lt;br /&gt;for (int i = 0; i &lt; HttpContext.Current.Request.Files.Count; i++)&lt;br /&gt;{&lt;br /&gt;// get the file instance&lt;br /&gt;HttpPostedFile fi = HttpContext.Current.Request.Files.Get(i);&lt;br /&gt;// create a byte array to store the file bytes&lt;br /&gt;byte[] fileBytes = new byte[fi.ContentLength];&lt;br /&gt;// fill the byte array&lt;br /&gt;using (System.IO.Stream stream = fi.InputStream)&lt;br /&gt;{&lt;br /&gt;stream.Read(fileBytes, 0, fi.ContentLength);&lt;br /&gt;}&lt;br /&gt;// create a random file name&lt;br /&gt;fileName = Guid.NewGuid().ToString();&lt;br /&gt;&lt;br /&gt;// write the resized file to the file system&lt;br /&gt;File.WriteAllBytes(fileDirectory + fileName + "_thumb.jpg", ResizeImageFile(fileBytes, 75));&lt;br /&gt;fileBytes = null;&lt;br /&gt;}&lt;br /&gt;return (fileName + "_thumb.jpg");&lt;br /&gt;}&lt;br /&gt;public void HandleUploadedFileUseExistingName(string directory, string fname)&lt;br /&gt;{&lt;br /&gt;// get the root of the web site&lt;br /&gt;string root = HttpContext.Current.Server.MapPath("~/");&lt;br /&gt;// clean up the path&lt;br /&gt;if (!root.EndsWith(@"\"))&lt;br /&gt;root += @"\";&lt;br /&gt;// make a folder to store the images in&lt;br /&gt;string fileDirectory = root + @"\" + directory + "\\";&lt;br /&gt;// loop through the file in the request&lt;br /&gt;for (int i = 0; i &lt; HttpContext.Current.Request.Files.Count; i++)&lt;br /&gt;{&lt;br /&gt;// get the file instance&lt;br /&gt;HttpPostedFile fi = HttpContext.Current.Request.Files.Get(i);&lt;br /&gt;// create a byte array to store the file bytes&lt;br /&gt;byte[] fileBytes = new byte[fi.ContentLength];&lt;br /&gt;// fill the byte array&lt;br /&gt;using (System.IO.Stream stream = fi.InputStream)&lt;br /&gt;{&lt;br /&gt;stream.Read(fileBytes, 0, fi.ContentLength);&lt;br /&gt;}&lt;br /&gt;// create a random file name&lt;br /&gt;fileName = fname;&lt;br /&gt;// write the resized file to the file system&lt;br /&gt;File.WriteAllBytes(fileDirectory + fileName, ResizeImageFile(fileBytes, 75));&lt;br /&gt;fileBytes = null;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;/// This fuction returns a Byte array containing the resized file&lt;br /&gt;private static byte[] ResizeImageFile(byte[] imageFile, int targetSize)&lt;br /&gt;{&lt;br /&gt;using (System.Drawing.Image oldImage =&lt;br /&gt;System.Drawing.Image.FromStream(new MemoryStream(imageFile)))&lt;br /&gt;{&lt;br /&gt;//If you want to maintain the propotion use following code&lt;br /&gt;//Size newSize = CalculateDimensions(oldImage.Size, targetSize);&lt;br /&gt;//If you want to use a fixed size use following one&lt;br /&gt;Size newSize = GetDimension();&lt;br /&gt;using (Bitmap newImage =&lt;br /&gt;new Bitmap(newSize.Width,&lt;br /&gt;newSize.Height, PixelFormat.Format24bppRgb))&lt;br /&gt;{&lt;br /&gt;using (Graphics canvas = Graphics.FromImage(newImage))&lt;br /&gt;{&lt;br /&gt;canvas.SmoothingMode = SmoothingMode.AntiAlias;&lt;br /&gt;canvas.InterpolationMode = InterpolationMode.HighQualityBicubic;&lt;br /&gt;canvas.PixelOffsetMode = PixelOffsetMode.HighQuality;&lt;br /&gt;canvas.DrawImage(oldImage,&lt;br /&gt;new Rectangle(new Point(0, 0), newSize));&lt;br /&gt;MemoryStream m = new MemoryStream();&lt;br /&gt;newImage.Save(m, ImageFormat.Jpeg);&lt;br /&gt;return m.GetBuffer();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;/// This function Calculates the new size of the image based on the target size&lt;br /&gt;private static Size CalculateDimensions(Size oldSize, int targetSize)&lt;br /&gt;{&lt;br /&gt;Size newSize = new Size();&lt;br /&gt;if (oldSize.Height &gt; oldSize.Width)&lt;br /&gt;{&lt;br /&gt;newSize.Width =&lt;br /&gt;(int)(oldSize.Width * ((float)targetSize / (float)oldSize.Height));&lt;br /&gt;newSize.Height = targetSize;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;newSize.Width = targetSize;&lt;br /&gt;newSize.Height =&lt;br /&gt;(int)(oldSize.Height * ((float)targetSize / (float)oldSize.Width));&lt;br /&gt;}&lt;br /&gt;return newSize;&lt;br /&gt;}&lt;br /&gt;//Dimension of the images can be set here&lt;br /&gt;private static Size GetDimension()&lt;br /&gt;{&lt;br /&gt;Size newSize = new Size();&lt;br /&gt;newSize.Width = 100;&lt;br /&gt;newSize.Height = 100;&lt;br /&gt;return newSize;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You can download source code from &lt;a href="http://cid-23012cf9caa8e2ce.skydrive.live.com/self.aspx/Public/Blog-sourcecodes/ImageUpload.rar" target="_blank"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-2679827930432198170?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/6NLldCjyiQM" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/6NLldCjyiQM/image-resizing-while-uploading-using.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/07/image-resizing-while-uploading-using.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-5326403308346399186</guid><pubDate>Fri, 03 Jul 2009 17:09:00 +0000</pubDate><atom:updated>2009-07-03T10:15:12.478-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><title>Convert data table to data reader</title><description>In some situations you may need to convert your data table to data reader, suppose you have a Data table named dt and etDataFromDB() is a function that returns a data table, here is the steps to convert data table to data reader.&lt;br /&gt;       &lt;span style="color: rgb(51, 51, 255);"&gt; DataTable dt = new DataTable();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;        dt = getDataFromDB();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;        DataTableReader dtr;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;        dtr = dt.CreateDataReader();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;         while (dtr.Read())&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;         &lt;span style="color: rgb(51, 102, 102);"&gt; //Do your tasks    &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;        &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;        }       &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-5326403308346399186?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/TOTw5LnwefI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/TOTw5LnwefI/convert-data-table-to-data-reader.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/07/convert-data-table-to-data-reader.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-1437285177727927083</guid><pubDate>Tue, 30 Jun 2009 12:23:00 +0000</pubDate><atom:updated>2009-06-30T05:34:27.687-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">Grid View</category><title>Calling a server side function from Grid view</title><description>Suppose you have a Grid view and you want to display values returned from a server side function that accepts a bound value rather displaying bounded values itself, then you have to add a template field in the Grid view and add following code.&lt;br /&gt;                 &lt;span style="color: rgb(51, 51, 255);"&gt;  &amp;lt;asp:TemplateField HeaderText="Status"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;                    &amp;lt;ItemTemplate&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;                    &amp;lt;%#YourFunction(Eval("Status"))%&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;                    &amp;lt;/ItemTemplate&amp;gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;                    &amp;lt;/asp:TemplateField&amp;gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-1437285177727927083?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/dMlMOS5g16I" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/dMlMOS5g16I/calling-server-side-function-from-grid.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/06/calling-server-side-function-from-grid.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-6157939664274867056</guid><pubDate>Sun, 28 Jun 2009 16:02:00 +0000</pubDate><atom:updated>2009-06-28T09:57:35.255-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">Grid View</category><title>Add auto number column in Gridview</title><description>In many situations we may need to add auto number or serial numbers in grid view  column, but we cannot find a property in property window to add this.&lt;br /&gt;We can add auto number column in Grid view or Data List by using &lt;span style="font-weight: bold;"&gt;Container.DataItemIndex&lt;/span&gt; property in Gridview or Data List mark up.&lt;br /&gt;&lt;br /&gt;Add a Template field and add following code in Grid view Mark up:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;&amp;lt;asp:TemplateField HeaderText="Serial Number"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    &amp;lt;ItemTemplate&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;        &amp;lt;%# Container.DataItemIndex + 1 %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    &amp;lt;/ItemTemplate&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    &amp;lt;/asp:TemplateField&amp;gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-6157939664274867056?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/EhdPQ1IDDJ8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/EhdPQ1IDDJ8/add-auto-number-column-in-gridview.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/06/add-auto-number-column-in-gridview.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-3962341803579343230</guid><pubDate>Sun, 28 Jun 2009 11:32:00 +0000</pubDate><atom:updated>2009-06-28T04:57:21.672-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">xml</category><title>Calling parameterized XML web service from javascript</title><description>In a previous post i have explained about calling a web service from javascript, please see &lt;a href="http://prajeeshkk.blogspot.com/2009/05/calling-web-service-from-javascript.html"&gt;this post&lt;/a&gt; to see calling a web service without parameters.&lt;br /&gt;Suppose you have a web service that accepts user name and password and returns a value in XML format and you want to show the returned value in a webpage or a widget.&lt;br /&gt;&lt;br /&gt;For example :&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;br /&gt;&amp;lt;int xmlns="http://tempuri.org/"&amp;gt;1&amp;lt;/int&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;You can use following code snippet to call a web service from javascript:&lt;br /&gt;&amp;lt;script language="text/javascript"&amp;gt;&lt;br /&gt;var returned_data;&lt;br /&gt;var request = new XMLHttpRequest();&lt;br /&gt;&lt;span style="color:#009900;"&gt;//function to initialize web service&lt;/span&gt;&lt;br /&gt;function initializeWebservice()&lt;br /&gt;{&lt;br /&gt;var url="http://2test.hopto.org/Leadservice.asmx/GetLeadCounts?UserName=Prajeesh&amp;amp;Password=123456";; &lt;span style="color:#009900;"&gt;//Web service url&lt;br /&gt;&lt;/span&gt;request.onreadystatechange = webStatusProc;&lt;br /&gt;request.open( "GET", url, true );&lt;br /&gt;request.send();&lt;br /&gt;}&lt;br /&gt;&lt;span style="color:#009900;"&gt;//function to process webservice response&lt;br /&gt;&lt;/span&gt;function webStatusProc()&lt;br /&gt;{&lt;br /&gt;if (request.readyState == 4) &lt;span style="color:#009900;"&gt;// Request completed?&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;response = request.responseXML.toXML();&lt;br /&gt;XML = XMLDOM.parse( response);&lt;br /&gt;returned_data= XML.evaluate('string(/int)');&lt;br /&gt;alert(returned-data);&lt;br /&gt;&lt;span style="color:#006600;"&gt;//do anything with returned data&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-3962341803579343230?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/xQTLsCVCoes" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/xQTLsCVCoes/calling-parameterized-xml-web-service.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/06/calling-parameterized-xml-web-service.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-7992782047693001348</guid><pubDate>Fri, 05 Jun 2009 14:55:00 +0000</pubDate><atom:updated>2009-06-05T08:00:24.999-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">web development</category><category domain="http://www.blogger.com/atom/ns#">web design</category><title>Google website speed analyzer Add-on released</title><description>Google code released an open source web page speed analyzer for Mozilla, called "Page Speed" it works like yahoo Yslow.&lt;br /&gt;&lt;br /&gt;Page Speed is an open-source Firefox/Firebug Add-on. Webmasters and web developers can use Page Speed to evaluate the performance of their web pages and to get suggestions on how to improve them.&lt;br /&gt;&lt;br /&gt;You can download it from &lt;a href="http://code.google.com/speed/page-speed/download.html"&gt;Here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-7992782047693001348?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/XXNDS7m92tA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/XXNDS7m92tA/google-website-speed-analyzer-add-on.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/06/google-website-speed-analyzer-add-on.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-7095584897424505782</guid><pubDate>Tue, 02 Jun 2009 22:48:00 +0000</pubDate><atom:updated>2009-06-03T00:59:28.824-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><title>Client side image upload validation in asp.net</title><description>We can upload images very easily using File upload control in asp.net, also you can validate the upload the file type using Reguler expression validator, following is the regular expression validation control code for validating image types such as jpg, png and bmp.&lt;br /&gt;&lt;span style="color:#3366ff;"&gt;&amp;lt;asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"&lt;br /&gt;          ErrorMessage="Upload a valid image (jpg/png/bmp)"&lt;br /&gt;          ValidationExpression ="^.+\.((jpg)(JPG)(gif)(GIF)(jpeg)(JPEG)(png)(PNG)(bmp)(BMP))$"&lt;br /&gt;          ControlToValidate="fupImage" ValidationGroup="Author_reg"&amp;gt; Upload a valid image;&amp;lt;/asp:RegularExpressionValidator&amp;gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-7095584897424505782?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/y8_LL5R8omU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/y8_LL5R8omU/client-side-image-upload-validation-in.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/06/client-side-image-upload-validation-in.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-1005961501253877608</guid><pubDate>Fri, 15 May 2009 21:46:00 +0000</pubDate><atom:updated>2009-05-18T12:30:25.642-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">web service</category><title>Calling a web service from javascript</title><description>Suppose you have a web service that returns a value in XML format and you want to show the returned value in a webpage or a widget.&lt;br /&gt;For example :&lt;br /&gt;&lt;span style="color:#009900;"&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;br /&gt;&amp;lt;int xmlns="http://tempuri.org/"&amp;gt;1&amp;lt;/int&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;You can use following code snippet to call a web service from javascript:&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;&amp;lt;script language="text/javascript"&amp;gt;&lt;br /&gt;var returned_data;&lt;br /&gt;var request = new XMLHttpRequest();&lt;br /&gt;//function to initialize web service&lt;br /&gt;function initializeWebservice()&lt;br /&gt;{&lt;br /&gt;var url = &lt;/span&gt;&lt;a href="http://localhost/Testwebservice.asmx/GetLeadCounts"&gt;&lt;span style="color:#6633ff;"&gt;http://Localhost/Testwebservice.asmx/GetLeadCounts&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#6633ff;"&gt;; //Web service url&lt;br /&gt;request.onreadystatechange = webStatusProc;&lt;br /&gt;request.open( "GET", url, true );&lt;br /&gt;request.send();&lt;br /&gt;}&lt;br /&gt;//function to process webservice response&lt;br /&gt;function webStatusProc()&lt;br /&gt;{&lt;br /&gt;if (request.readyState == 4) // Request completed?&lt;br /&gt;{&lt;br /&gt;response = request.responseXML.toXML();&lt;br /&gt;XML = XMLDOM.parse( response);&lt;br /&gt;returned_data= XML.evaluate('string(/int)');&lt;br /&gt;alert(returned-data);&lt;br /&gt;//do anything with returned data&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-1005961501253877608?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/kXGO6el0IuI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/kXGO6el0IuI/calling-web-service-from-javascript.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/05/calling-web-service-from-javascript.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-6333672471972878798</guid><pubDate>Fri, 15 May 2009 11:25:00 +0000</pubDate><atom:updated>2009-05-15T14:46:01.900-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">web service</category><title>The test form is only available for requests from the local machine</title><description>If you find &lt;em&gt;"The test form is only available for requests from the local machine"&lt;/em&gt; message in your webservice page after hosted in your server, dont worry just add following tags in your web.config file just before &amp;lt;/system.web&amp;gt;&lt;br /&gt;tag&lt;br /&gt; &amp;lt;webServices&amp;gt;&lt;br /&gt;       &amp;lt;protocols&amp;gt;&lt;br /&gt;         &amp;lt;add name="HttpGet"/&amp;gt;&lt;br /&gt;         &amp;lt;add name="HttpPost"/&amp;gt;&lt;br /&gt;       &amp;lt;/protocols&amp;gt;&lt;br /&gt;&amp;lt;/webServices&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-6333672471972878798?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/uzZaGkrLUO4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/uzZaGkrLUO4/test-form-is-only-available-for.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/05/test-form-is-only-available-for.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6262810033751140470.post-7570733078924218613</guid><pubDate>Tue, 05 May 2009 07:22:00 +0000</pubDate><atom:updated>2009-05-05T00:40:38.817-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><title>How to create visitors counter using ASP dot net</title><description>In some sites you may have seen visitors counter/Total hits at the bottom of the website, in asp.net it is very easy to implement this feature, here i will show you a simple example that stores visitors count in a Text file.&lt;br /&gt;First you have to add a Global.asax file into the solution you are working, you can do this by Right clicking your project name in the solution explorer -&gt;Add New Item -&gt; Global Application Class.&lt;br /&gt;create a Hits.txt file in the root folder of your application and just add following code in the Session_Start event in the Global.asax file.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;void Session_Start(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;// Code that runs when a new session is started&lt;br /&gt;Application.Lock();&lt;br /&gt;if (System.IO.File.Exists(Server.MapPath(Request.ApplicationPath + "/Hits.txt")))&lt;br /&gt;{&lt;br /&gt;System.IO.StreamReader sr = new System.IO.StreamReader(Server.MapPath(Request.ApplicationPath + "/Hits.txt"));&lt;br /&gt;string count = sr.ReadToEnd();&lt;br /&gt;sr.Dispose();&lt;br /&gt;Application["Hits"] = int.Parse(count) + 1;&lt;br /&gt;System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath(Request.ApplicationPath + "/Hits.txt"));&lt;br /&gt;sw.Write(Application["Hits"].ToString());&lt;br /&gt;sw.Dispose();&lt;br /&gt;}&lt;br /&gt;//Application["Hits"] = int.Parse(Application["Hits"].ToString()) + 1;&lt;br /&gt;Application["OnlineUsers"] = (int)Application["OnlineUsers"] + 1;&lt;br /&gt;Application.UnLock();&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;strong&gt;Reading Data from Hits.text file:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;if (System.IO.File.Exists(Server.MapPath(Request.ApplicationPath + "/TestFile.txt"))){&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;System.IO.StreamReader sr = new System.IO.StreamReader(Server.MapPath(Request.ApplicationPath + "/Hits.txt"));&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;string strdata = sr.ReadToEnd();&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;sr.Dispose();&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;Here total hits will be available in "strdata" variable.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;we have to create a StreamReader object to read data from a text file, follow this &lt;a href="http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx"&gt;MSDN article &lt;/a&gt;to know more about StreamReader class.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6262810033751140470-7570733078924218613?l=prajeeshkk.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PrajeeshsTechBlog/~4/OvFybRz8IJ8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/PrajeeshsTechBlog/~3/OvFybRz8IJ8/how-to-create-visitors-counter-using.html</link><author>noreply@blogger.com (prajeesh)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://prajeeshkk.blogspot.com/2009/05/how-to-create-visitors-counter-using.html</feedburner:origLink></item></channel></rss>
