<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>X Lines 1 Goal</title>
        <link>http://geekswithblogs.net/xlinesonegoal/Default.aspx</link>
        <description> </description>
        <language>en-US</language>
        <copyright>xlinesonegoal</copyright>
        <managingEditor>mail.manti@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>X Lines 1 Goal</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/xlinesonegoal/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Selecting Items in a list using DIVs instead of Radio Buttons</title>
            <category>ASP VB</category>
            <category>Javascript</category>
            <link>http://geekswithblogs.net/xlinesonegoal/archive/2008/12/01/selecting-items-in-a-list-using-divs-instead-of-radio.aspx</link>
            <description>&lt;strong&gt;&lt;font face="Arial" size="5"&gt;Selecting Items in a list using DIVs instead of Radio Buttons&lt;/font&gt;&lt;/strong&gt;
&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; Radio buttons cannot be styled using CSS. Another problem is that they simply f*** up your design if used incorrectly. They are also not very useful if you would like a user to be able to click on a large item in order to select it.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution: &lt;/strong&gt;A solution to this problem would be to allow the user to click on whole DIVs in order to select an item. This is done using some javascript, CSS and a hidden textbox. This is how it's done using ASP VB and Javascript. Obviously this can be done using other Server Side languages as the main work will be done by Javascript. So...&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight: bold;"&gt;This is the javascript needed&lt;/span&gt;.&lt;br /&gt;
&lt;/p&gt;
&lt;span style="font-family: Courier New;"&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    &lt;span style="background-color: rgb(255, 255, 0);"&gt;var selected = 0;&lt;/span&gt; //holds the selected div id... set to be the first selected item (in this case - 0)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    &lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    function selectDIV(newid)&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    {&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        document.getElementById('div' + selected).className = 'item'; //change previously selected item CSS&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        selected = newid; //set 'selected' as the new id&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        document.getElementById('div' + selected).className = 'itemselected'; //change the newly selected item CSS&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        document.getElementById('selecteddivid').value = selected; //set value of hidden textbox to selected div id&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    }&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;p&gt;The highlighted part in this code is the most important thing. The 'selected' variable holds the ID Number of the selected DIV. It is important to set it by default as the item selected when the page loads.&lt;/p&gt;
&lt;span style="font-weight: bold;"&gt;This is the HTML/ASPVB code needed&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New;"&gt;    &amp;lt;% for i = 0 to 5 &lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        if i = 0 then&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;            myclass = "itemselected"&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        else&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;            myclass = "item"&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        end if&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        &lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        &lt;span style="background-color: rgb(255, 255, 0);"&gt;divid = "div" &amp;amp; i&lt;/span&gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    %&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        &amp;lt;div class="&amp;lt;%= myclass %&amp;gt;" &lt;span style="background-color: rgb(255, 255, 0);"&gt;id="&amp;lt;%= divid %&amp;gt;" onclick="selectDIV(&amp;lt;%= i %&amp;gt;)&lt;/span&gt;"&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;            To select DIV #&amp;lt;%= i %&amp;gt; click here.&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    &amp;lt;% next %&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    &lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    &amp;lt;form action="default.asp" method="post"&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        &lt;span style="background-color: rgb(255, 255, 0);"&gt;&amp;lt;input type="hidden" id="selecteddivid" name="selecteddivid" value="0" /&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;        &amp;lt;input type="submit" value="SAVE" /&amp;gt;&lt;/span&gt;&lt;br style="font-family: Courier New;" /&gt;
&lt;span style="font-family: Courier New;"&gt;    &amp;lt;/form&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
In this case, I used a loop from 0 to 5 to generate 6 divs. The ID of each DIV is 'div&lt;span style="color: rgb(128, 128, 128);"&gt;x&lt;/span&gt;' where x is a number from the loop. The onclick event calls the selectDIV function which we did above. As you can see a hidden textbox 'selecteddivid' is created here which will hold the selected div's id. This can later be read using &lt;span style="font-family: Courier New;"&gt;request.form("selecteddivid") &lt;span style="font-family: Arial;"&gt;after the form posts.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;p&gt;&lt;strong&gt;Conclusion: &lt;/strong&gt;Javascripts like this are easy to create and will help you create better-looking webpages by allowing the user to interact better with your website.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight: bold; text-decoration: underline;"&gt;Code example will be coming soon.&lt;/span&gt;&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127478"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127478" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/xlinesonegoal/aggbug/127478.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>xlinesonegoal</dc:creator>
            <guid>http://geekswithblogs.net/xlinesonegoal/archive/2008/12/01/selecting-items-in-a-list-using-divs-instead-of-radio.aspx</guid>
            <pubDate>Mon, 01 Dec 2008 15:20:14 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/xlinesonegoal/comments/127478.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/xlinesonegoal/archive/2008/12/01/selecting-items-in-a-list-using-divs-instead-of-radio.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/xlinesonegoal/comments/commentRss/127478.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Send Cookie in HTTP Header WebRequest (ASP.NET C# Web Services)</title>
            <category>Web Servies</category>
            <link>http://geekswithblogs.net/xlinesonegoal/archive/2008/10/10/send-cookie-in-http-header-webrequest-asp.net-c-web-services.aspx</link>
            <description>&lt;strong&gt;&lt;font face="Arial" size="5"&gt;
&lt;h3&gt;&lt;strong&gt;&lt;font face="Arial" size="5"&gt;Send Cookie in HTTP Header WebRequest&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;/font&gt;&lt;/strong&gt;
&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; You are using a third-party web service to which you are connecting with your own web service. The third-party web service is divided into two phases. Phase 1 is dependent on nothing i.e. you just pass the parameters and the web service returns the details you would like. Phase 2 though is dependent on the first. The problem is that the second phase -- apart from the method parameters -- also requests that you pass on the JSessionID value which was returned to you in Phase 1. This value must be sent in a cookie. How can this be done?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reason:&lt;/strong&gt; When getting data from large databases it is impossible to save all possible combinations. For example, if you are getting all flights between London and Madrid, the data is being fetched from a database. That is Phase 1. But, the IDs sent to you which can be used to get further details on the particular ID of the response cannot all be saved in a database somewhere as it would be extremely redundant to hold all possible combinations. So instead, a session is created on the server and while that session is active the IDs for your particular search are saved. Temporarily. So in order to get the details in Phase 2 you must notify the server which search you are referring to from Phase 1.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution: &lt;/strong&gt;Obviously, you must first execute Phase 1. From there get the JSessionID which will be passed on to the next Phase. The following is all the code you need to call the web service. In it you will find the code to create the JSessionID cookie highlighted in yellow.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;font face="courier new"&gt;byte[] buffer = Encoding.ASCII.GetBytes("fareId=123456"); //the data you want to send to the web service&lt;br /&gt;
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(url);&lt;br /&gt;
WebReq.Method = "POST";&lt;br /&gt;
WebReq.ContentType = "application/x-www-form-urlencoded";&lt;br /&gt;
WebReq.ContentLength = buffer.Length;&lt;br /&gt;
&lt;font style="background-color: rgb(255, 255, 0);"&gt;WebReq.Headers["Cookie"] = "JSESSIONID=4567845226"&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="courier new"&gt;Stream PostData = WebReq.GetRequestStream();&lt;br /&gt;
PostData.Write(buffer, 0, buffer.Length);&lt;br /&gt;
PostData.Close();&lt;br /&gt;
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();&lt;br /&gt;
Stream Answer = WebResp.GetResponseStream();&lt;br /&gt;
StreamReader _Answer = new StreamReader(Answer);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;The most important part of the code is highlighted in yellow. In that line of code we are passing a cookie called JSESSIONID with the value 4567845226. When this request arrives at the web service, the first thing it does is it checks the cookie which was passed in the header. It then fetches the Phase 1 search response and continues Phase 2 from there.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conclusion: &lt;/strong&gt;The CookieContainer object does not work as intended when passing this JSessionID value. This is the only effective method which I found to this process. Note that the cookie name 'JSESSIONID' was used as an example. Various web services use various names for their SessionId cookie.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125757"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125757" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/xlinesonegoal/aggbug/125757.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>xlinesonegoal</dc:creator>
            <guid>http://geekswithblogs.net/xlinesonegoal/archive/2008/10/10/send-cookie-in-http-header-webrequest-asp.net-c-web-services.aspx</guid>
            <pubDate>Fri, 10 Oct 2008 19:18:25 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/xlinesonegoal/comments/125757.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/xlinesonegoal/archive/2008/10/10/send-cookie-in-http-header-webrequest-asp.net-c-web-services.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/xlinesonegoal/comments/commentRss/125757.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>