<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/"><channel><title>ASP.NET 2.0</title><link>http://blogs.clearscreen.com/raylinder/category/104.aspx</link><description>Topics, Code Samples, and Discussions on ASP.NET 2.0</description><managingEditor>Ray Linder</managingEditor><dc:language>en-US</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Ray Linder</dc:creator><title>Using SMTP and Gmail in ASP.NET 2.0...</title><link>http://blogs.clearscreen.com/raylinder/archive/2007/01/13/5959.aspx</link><pubDate>Sat, 13 Jan 2007 00:41:00 GMT</pubDate><guid>http://blogs.clearscreen.com/raylinder/archive/2007/01/13/5959.aspx</guid><wfw:comment>http://blogs.clearscreen.com/raylinder/comments/5959.aspx</wfw:comment><comments>http://blogs.clearscreen.com/raylinder/archive/2007/01/13/5959.aspx#Feedback</comments><slash:comments>28</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/raylinder/comments/commentRss/5959.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/raylinder/services/trackbacks/5959.aspx</trackback:ping><description>&lt;p&gt;Ok, Google (Gmail) is hosting our emails through "domain sharing". Basically, any emails being sent to &lt;a href="mailto:raylinder@glacsy.com"&gt;raylinder@glacsy.com&lt;/a&gt; goes to Gmail and Gmail hosts it. My concern was SMTP from our website in ASP.NET 2.0. Yes, sound overwhelmingly exciting doesn't it? Well, there's is a way, the LONG and easier way or the short and painful way. LONG and easier way is, you build a SMTP class/control and namespace it to something like Glacsy.Net.WebMail then create a the SMTP assembly to accept parameters like From, To, BCC, Subject, Body. Then every page you want to send email, just map it to the class. Long time to build it, easy to use. I'm not getting into the short and painful way, you can just use your imagination. Below is some code on your page (yes, finally I'm including code):&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:a47bec56-8e2a-4b77-bd3b-f7696936639e" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;pre style="BACKGROUND-COLOR: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="COLOR: #000000"&gt;Glacsy.Net.WebMail.SMTP(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;welcome@glacsy.com&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;, someone@their&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;-&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;email.com, &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;bcc@some-one-else.com&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;, &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;My Subject&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;, &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;My body or message...&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This is what you would use to pass a page to email. Below is the SMTP.cs code in the App_Code directory to use:&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:4dd1af65-45cc-460b-a4f3-8b9742a06fcb" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;pre style="BACKGROUND-COLOR: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; System.Net;
&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; System.Net.Mail;
&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; System.Text;

&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;namespace&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; Glacsy.Net
{
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; WebMail
    {
        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; SMTP(&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; from, &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; to, &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; bcc, &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; subject, &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; body)
        {
            MailMessage mailMsg &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; MailMessage();
            mailMsg.From &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; MailAddress(from);
            mailMsg.To.Add(to);
            mailMsg.Subject &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; subject;
            mailMsg.IsBodyHtml &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;true&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
            mailMsg.BodyEncoding &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; Encoding.UTF8;
            mailMsg.Body &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; body;
            mailMsg.Priority &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; MailPriority.Normal;
            &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; Smtp configuration&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            SmtpClient client &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; SmtpClient();
            client.Credentials &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; NetworkCredential(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;youremail@gmail.com&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;, &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;yourpassword&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;);
            client.Port &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;587&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;; &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;or use 465            &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            client.Host &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;smtp.gmail.com&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
            client.EnableSsl &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;true&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;object&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; userState &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; mailMsg;
            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;try&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
            {
                &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;you can also call client.Send(msg)&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                client.SendAsync(mailMsg, userState);
            }
            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;catch&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (SmtpException)
            {
                &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;Catch errors...&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            }
        }
    }
}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Now, this is the easiest and simplest way I could think for sending email via Gmail. If you have a better way, let me know and I'll test it out. The good thing is the speed of development this setup will provide in the long run. I may build and release a .dll file of this in the future for everyone. But for now, enjoy...&lt;img src ="http://blogs.clearscreen.com/raylinder/aggbug/5959.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>Ok, Google (Gmail) is hosting our emails through "domain sharing". Basically, any emails being sent to <a href="mailto:raylinder@glacsy.com">raylinder@glacsy.com</a> goes to Gmail and Gmail hosts it. My concern was SMTP from our website in ASP.NET 2.0. Yes, sound overwhelmingly exciting doesn't it? Well, there's is a way, the LONG and easier way or the short and painful way. LONG and easier way is, you build a SMTP class/control and namespace it to something like Glacsy.Net.WebMail then create a the SMTP assembly to accept parameters like From, To, BCC, Subject, Body. Then every page you want to send email, just map it to the class. Long time to build it, easy to use. I'm not getting into the short and painful way, you can just use your imagination. Below is some code on your page (yes, finally I'm including code):</p>
<div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:a47bec56-8e2a-4b77-bd3b-f7696936639e" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"><pre style="BACKGROUND-COLOR: white"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="COLOR: #000000">Glacsy.Net.WebMail.SMTP(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">welcome@glacsy.com</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, someone@their</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">email.com, </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">bcc@some-one-else.com</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">My Subject</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">My body or message...</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);</span></div></pre></div><br />This is what you would use to pass a page to email. Below is the SMTP.cs code in the App_Code directory to use:<br /><br />
<p></p>
<div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:4dd1af65-45cc-460b-a4f3-8b9742a06fcb" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"><pre style="BACKGROUND-COLOR: white"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.Net;
</span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.Net.Mail;
</span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.Text;

</span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> Glacsy.Net
{
    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> WebMail
    {
        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> SMTP(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> from, </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> to, </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> bcc, </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> subject, </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> body)
        {
            MailMessage mailMsg </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> MailMessage();
            mailMsg.From </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> MailAddress(from);
            mailMsg.To.Add(to);
            mailMsg.Subject </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> subject;
            mailMsg.IsBodyHtml </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;
            mailMsg.BodyEncoding </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Encoding.UTF8;
            mailMsg.Body </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> body;
            mailMsg.Priority </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> MailPriority.Normal;
            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Smtp configuration</span><span style="COLOR: #008000">
</span><span style="COLOR: #000000">            SmtpClient client </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> SmtpClient();
            client.Credentials </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> NetworkCredential(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">youremail@gmail.com</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">yourpassword</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);
            client.Port </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">587</span><span style="COLOR: #000000">; </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">or use 465            </span><span style="COLOR: #008000">
</span><span style="COLOR: #000000">            client.Host </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">smtp.gmail.com</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;
            client.EnableSsl </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;
            </span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000"> userState </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> mailMsg;
            </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000">
            {
                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">you can also call client.Send(msg)</span><span style="COLOR: #008000">
</span><span style="COLOR: #000000">                client.SendAsync(mailMsg, userState);
            }
            </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000"> (SmtpException)
            {
                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">Catch errors...</span><span style="COLOR: #008000">
</span><span style="COLOR: #000000">            }
        }
    }
}</span></div></pre></div><br />Now, this is the easiest and simplest way I could think for sending email via Gmail. If you have a better way, let me know and I'll test it out. The good thing is the speed of development this setup will provide in the long run. I may build and release a .dll file of this in the future for everyone. But for now, enjoy...<img src ="http://blogs.clearscreen.com/raylinder/aggbug/5959.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Ray Linder</dc:creator><title>:: Tip/Trick: Updating a database when using Page_Load to load data ::</title><link>http://blogs.clearscreen.com/raylinder/archive/2006/10/17/3999.aspx</link><pubDate>Tue, 17 Oct 2006 17:01:00 GMT</pubDate><guid>http://blogs.clearscreen.com/raylinder/archive/2006/10/17/3999.aspx</guid><wfw:comment>http://blogs.clearscreen.com/raylinder/comments/3999.aspx</wfw:comment><comments>http://blogs.clearscreen.com/raylinder/archive/2006/10/17/3999.aspx#Feedback</comments><slash:comments>21</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/raylinder/comments/commentRss/3999.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/raylinder/services/trackbacks/3999.aspx</trackback:ping><description>&lt;p&gt;When reading data from a database using the Page_Load event and then updating the database, the data doesn't get updated as &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=796866&amp;amp;SiteID=1" target="_blank"&gt;described here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;By including &lt;br /&gt;&lt;br /&gt;if (!Page.IsPostback) &lt;br /&gt;&lt;br /&gt;in before the reader allows data to be updated in other areas on the page/form. Below are examples:&lt;br /&gt;&lt;br /&gt;Update doesn't work:&lt;br /&gt;==================================================================&lt;br /&gt;&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;      DataList1.DataBind(); &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)&lt;br /&gt;{&lt;br /&gt;      SqlConnection sqlConn = new SqlConnection("connection");&lt;br /&gt;      SqlCommand sqlComm = new SqlCommand("UPDATE blog_Postings SET title = @title, body = @body WHERE (id = @id)", sqlConn);&lt;br /&gt;&lt;br /&gt;      sqlComm.Parameters.Add(new SqlParameter("@id", SqlDbType.Int));&lt;br /&gt;      sqlComm.Parameters["@id"].Value = intID;&lt;br /&gt;      sqlComm.Parameters.Add(new SqlParameter("@title", SqlDbType.NVarChar));&lt;br /&gt;      sqlComm.Parameters["@title"].Value = strTitle;&lt;br /&gt;      sqlComm.Parameters.Add(new SqlParameter("@body", SqlDbType.NVarChar));&lt;br /&gt;      sqlComm.Parameters["@body"].Value = strBody;&lt;br /&gt;&lt;br /&gt;      sqlComm.CommandType = CommandType.StoredProcedure; &lt;br /&gt;&lt;br /&gt;      sqlConn.Open();&lt;br /&gt;      sqlComm.ExecuteNonQuery();&lt;br /&gt;      sqlConn.Close();&lt;br /&gt;      sqlComm.Dispose();&lt;br /&gt;&lt;br /&gt;      DataList1.EditItemIndex = -1;&lt;br /&gt;      DataList1.DataBind();&lt;br /&gt;} &lt;/p&gt;
&lt;p&gt;When the DataList is updating, the function protected void Page_Load(object sender, EventArgs e) runs again/refreshes which retrieves the old values in the database.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Update works:&lt;br /&gt;==================================================================&lt;br /&gt;&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;      if (!Page.IsPostBack)&lt;br /&gt;      {&lt;br /&gt;            DataList1.DataBind();&lt;br /&gt;      } &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)&lt;br /&gt;{&lt;br /&gt;      SqlConnection sqlConn = new SqlConnection("connection");&lt;br /&gt;      SqlCommand sqlComm = new SqlCommand("UPDATE blog_Postings SET title = @title, body = @body WHERE (id = @id)", sqlConn);&lt;br /&gt;&lt;br /&gt;      sqlComm.Parameters.Add(new SqlParameter("@id", SqlDbType.Int));&lt;br /&gt;      sqlComm.Parameters["@id"].Value = intID;&lt;br /&gt;      sqlComm.Parameters.Add(new SqlParameter("@title", SqlDbType.NVarChar));&lt;br /&gt;      sqlComm.Parameters["@title"].Value = strTitle;&lt;br /&gt;      sqlComm.Parameters.Add(new SqlParameter("@body", SqlDbType.NVarChar));&lt;br /&gt;      sqlComm.Parameters["@body"].Value = strBody;&lt;br /&gt;&lt;br /&gt;      sqlConn.Open();&lt;br /&gt;      sqlComm.ExecuteNonQuery();&lt;br /&gt;      sqlConn.Close();&lt;br /&gt;      sqlComm.Dispose(); &lt;br /&gt;&lt;br /&gt;      DataList1.EditItemIndex = -1;&lt;br /&gt;      DataList1.DataBind();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;So, as you can see by not validating the postback will causes data not to update which will lead into hours of frustration. Enjoy...&lt;br /&gt;&lt;br /&gt;(Posted using Windows Live Writer)&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/raylinder/aggbug/3999.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>When reading data from a database using the Page_Load event and then updating the database, the data doesn't get updated as <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=796866&amp;SiteID=1" target="_blank">described here</a>.<br /><br />By including <br /><br />if (!Page.IsPostback) <br /><br />in before the reader allows data to be updated in other areas on the page/form. Below are examples:<br /><br />Update doesn't work:<br />==================================================================<br /><br />protected void Page_Load(object sender, EventArgs e)<br />{<br />      DataList1.DataBind(); <br />}<br /><br />protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)<br />{<br />      SqlConnection sqlConn = new SqlConnection("connection");<br />      SqlCommand sqlComm = new SqlCommand("UPDATE blog_Postings SET title = @title, body = @body WHERE (id = @id)", sqlConn);<br /><br />      sqlComm.Parameters.Add(new SqlParameter("@id", SqlDbType.Int));<br />      sqlComm.Parameters["@id"].Value = intID;<br />      sqlComm.Parameters.Add(new SqlParameter("@title", SqlDbType.NVarChar));<br />      sqlComm.Parameters["@title"].Value = strTitle;<br />      sqlComm.Parameters.Add(new SqlParameter("@body", SqlDbType.NVarChar));<br />      sqlComm.Parameters["@body"].Value = strBody;<br /><br />      sqlComm.CommandType = CommandType.StoredProcedure; <br /><br />      sqlConn.Open();<br />      sqlComm.ExecuteNonQuery();<br />      sqlConn.Close();<br />      sqlComm.Dispose();<br /><br />      DataList1.EditItemIndex = -1;<br />      DataList1.DataBind();<br />} </p>
<p>When the DataList is updating, the function protected void Page_Load(object sender, EventArgs e) runs again/refreshes which retrieves the old values in the database.<br /><br /><br />Update works:<br />==================================================================<br /><br />protected void Page_Load(object sender, EventArgs e)<br />{<br />      if (!Page.IsPostBack)<br />      {<br />            DataList1.DataBind();<br />      } <br />}<br /><br />protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)<br />{<br />      SqlConnection sqlConn = new SqlConnection("connection");<br />      SqlCommand sqlComm = new SqlCommand("UPDATE blog_Postings SET title = @title, body = @body WHERE (id = @id)", sqlConn);<br /><br />      sqlComm.Parameters.Add(new SqlParameter("@id", SqlDbType.Int));<br />      sqlComm.Parameters["@id"].Value = intID;<br />      sqlComm.Parameters.Add(new SqlParameter("@title", SqlDbType.NVarChar));<br />      sqlComm.Parameters["@title"].Value = strTitle;<br />      sqlComm.Parameters.Add(new SqlParameter("@body", SqlDbType.NVarChar));<br />      sqlComm.Parameters["@body"].Value = strBody;<br /><br />      sqlConn.Open();<br />      sqlComm.ExecuteNonQuery();<br />      sqlConn.Close();<br />      sqlComm.Dispose(); <br /><br />      DataList1.EditItemIndex = -1;<br />      DataList1.DataBind();<br />}<br /><br />So, as you can see by not validating the postback will causes data not to update which will lead into hours of frustration. Enjoy...<br /><br />(Posted using Windows Live Writer)</p><img src ="http://blogs.clearscreen.com/raylinder/aggbug/3999.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Ray Linder of Arizona</dc:creator><title>:: Just a status update ::</title><link>http://blogs.clearscreen.com/raylinder/archive/2006/04/10/2977.aspx</link><pubDate>Mon, 10 Apr 2006 12:01:00 GMT</pubDate><guid>http://blogs.clearscreen.com/raylinder/archive/2006/04/10/2977.aspx</guid><wfw:comment>http://blogs.clearscreen.com/raylinder/comments/2977.aspx</wfw:comment><comments>http://blogs.clearscreen.com/raylinder/archive/2006/04/10/2977.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/raylinder/comments/commentRss/2977.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/raylinder/services/trackbacks/2977.aspx</trackback:ping><description>Currently, I'm working with SQLite in the .NET framework (not going to well at the moment, getting INSERT error). It's a Teamspeak database file that uses SQLite developed in Perl (I hate Perl/PHP). In order to successfully register members into Teamspeak, without using MySQL (another unreliable, waste of time) and without intrupting current data, from a web application, I need to utilize .NET and SQLite using C#. Considering the lack of resources and information provided via Google for using these wonderful technologies, I haven't had much success in doing so (When using the INSERT command, Errors: "unable to open database file". Thus, the SELECT command works fine). Once this situation succeeds, this will be the first time ever using these technologies for a Teamspeak server. The pressure is on...&lt;img src ="http://blogs.clearscreen.com/raylinder/aggbug/2977.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">Currently, I'm working with SQLite in the .NET framework (not going to well at the moment, getting INSERT error). It's a Teamspeak database file that uses SQLite developed in Perl (I hate Perl/PHP). In order to successfully register members into Teamspeak, without using MySQL (another unreliable, waste of time) and without intrupting current data, from a web application, I need to utilize .NET and SQLite using C#. Considering the lack of resources and information provided via Google for using these wonderful technologies, I haven't had much success in doing so (When using the INSERT command, Errors: "unable to open database file". Thus, the SELECT command works fine). Once this situation succeeds, this will be the first time ever using these technologies for a Teamspeak server. The pressure is on...<img src ="http://blogs.clearscreen.com/raylinder/aggbug/2977.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Ray A. Linder</dc:creator><title>:: Multiple Site Mapping ::</title><link>http://blogs.clearscreen.com/raylinder/archive/2006/01/02/2662.aspx</link><pubDate>Mon, 02 Jan 2006 13:52:00 GMT</pubDate><guid>http://blogs.clearscreen.com/raylinder/archive/2006/01/02/2662.aspx</guid><wfw:comment>http://blogs.clearscreen.com/raylinder/comments/2662.aspx</wfw:comment><comments>http://blogs.clearscreen.com/raylinder/archive/2006/01/02/2662.aspx#Feedback</comments><slash:comments>17</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/raylinder/comments/commentRss/2662.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/raylinder/services/trackbacks/2662.aspx</trackback:ping><description>I finally discovered how to use multiple web.sitemap in my web applications. To use this, you will need to configure the web.config file first: (You will need to replace the "[" with "&amp;lt;" when using code.) &lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;pre&gt;
[configuration&amp;gt;
	[system.web&amp;gt;
		[siteMap enabled="true"
				 defaultProvider="SecuredSiteMapProvider"&amp;gt;
			[providers&amp;gt;
				[clear/&amp;gt;
				[add name="SecuredSiteMapProvider" 
					 type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
					 siteMapFile="~/web.sitemap" /&amp;gt;
				[add name="Ladies" 
					 type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
					 siteMapFile="~/Ladies/Web.sitemap"/&amp;gt;
				[add name="Men" 
					 type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
					 siteMapFile="~/Men/Web.sitemap"/&amp;gt;
			[/providers&amp;gt;
		[/siteMap&amp;gt;
	[/system.web&amp;gt;
[/configuration&amp;gt; 

&lt;/pre&gt;&lt;/span&gt;
Next, you'll need to configure the main web.sitemap file: (You will need to replace the "[" with "&amp;lt;" when using code.)
&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;pre&gt;

[siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" &amp;gt;
	[siteMapNode&amp;gt;
		[siteMapNode provider="Ladies" /&amp;gt;
		[siteMapNode provider="Men" /&amp;gt;
	[/siteMapNode&amp;gt;
[/siteMap&amp;gt;

&lt;/pre&gt;&lt;/span&gt;
Then, you'll need to configure the web.sitemap file in your subdirectory: (You will need to replace the "[" with "&amp;lt;" when using code.)
&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;pre&gt;

[siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" &amp;gt;
	[siteMapNode url=""
				 title=""
				 description=""&amp;gt;
		[siteMapNode url="~/default.aspx"
					 title="Home"
					 description="" &amp;gt;
			[siteMapNode url="~/ladies/default.aspx"
						 title="Ladies"/&amp;gt;
			[siteMapNode url="~/men/default.aspx"
						 title="Men"/&amp;gt;
		[/siteMapNode&amp;gt;
		[siteMapNode url="~/ladies/clothing/default.aspx"
					 title="Clothing"
					 description=""&amp;gt;
			[siteMapNode url="~/ladies/clothing/shirts/default.aspx"
						 title="Shirts"
						 description="" /&amp;gt;
			[siteMapNode url="~/ladies/clothing/pants/default.aspx"
						 title="Pants"
						 description="" /&amp;gt;
		[/siteMapNode&amp;gt;
		[siteMapNode url="~/ladies/cosmetics/default.aspx"
					 title="Cosmetics"
					 description=""&amp;gt;
			[siteMapNode url="" title="Make-Up"/&amp;gt;
		[/siteMapNode&amp;gt;
		[siteMapNode url="~/ladies/models/default.aspx"
					 title="Models"
					 description=""&amp;gt;
			[siteMapNode url="~/ladies/models/Aloree/default.aspx"
						 title="Aloree"
						 description="" /&amp;gt;
			[siteMapNode url="~/ladies/models/Twila/default.aspx"
						 title="Twila"
						 description="" /&amp;gt;
			[siteMapNode url="~/ladies/models/Dinnelle/default.aspx"
						 title="Dinnelle"
						 description="" /&amp;gt;
		[/siteMapNode&amp;gt;
		[siteMapNode url="~/contactus.aspx" title="Contact Us"/&amp;gt;
	[/siteMapNode&amp;gt;
[/siteMap&amp;gt;
&lt;/pre&gt;&lt;/span&gt;
Now, the point of this navigation structure is to seperate the navigation of two sites without creating multiple web.config files in you web app. In my web app, I wanted to build two sites within the same web app and include a structured navigation using multiple web.sitemap files inside the directories in the two sites. So, you have the main site A, then you have the two sites A1 and A2. If you need more details, let me know...

&lt;img src ="http://blogs.clearscreen.com/raylinder/aggbug/2662.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">I finally discovered how to use multiple web.sitemap in my web applications. To use this, you will need to configure the web.config file first: (You will need to replace the "[" with "&lt;" when using code.) <span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><pre>
[configuration&gt;
	[system.web&gt;
		[siteMap enabled="true"
				 defaultProvider="SecuredSiteMapProvider"&gt;
			[providers&gt;
				[clear/&gt;
				[add name="SecuredSiteMapProvider" 
					 type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
					 siteMapFile="~/web.sitemap" /&gt;
				[add name="Ladies" 
					 type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
					 siteMapFile="~/Ladies/Web.sitemap"/&gt;
				[add name="Men" 
					 type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
					 siteMapFile="~/Men/Web.sitemap"/&gt;
			[/providers&gt;
		[/siteMap&gt;
	[/system.web&gt;
[/configuration&gt; 

</pre></span>
Next, you'll need to configure the main web.sitemap file: (You will need to replace the "[" with "&lt;" when using code.)
<span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><pre>

[siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" &gt;
	[siteMapNode&gt;
		[siteMapNode provider="Ladies" /&gt;
		[siteMapNode provider="Men" /&gt;
	[/siteMapNode&gt;
[/siteMap&gt;

</pre></span>
Then, you'll need to configure the web.sitemap file in your subdirectory: (You will need to replace the "[" with "&lt;" when using code.)
<span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><pre>

[siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" &gt;
	[siteMapNode url=""
				 title=""
				 description=""&gt;
		[siteMapNode url="~/default.aspx"
					 title="Home"
					 description="" &gt;
			[siteMapNode url="~/ladies/default.aspx"
						 title="Ladies"/&gt;
			[siteMapNode url="~/men/default.aspx"
						 title="Men"/&gt;
		[/siteMapNode&gt;
		[siteMapNode url="~/ladies/clothing/default.aspx"
					 title="Clothing"
					 description=""&gt;
			[siteMapNode url="~/ladies/clothing/shirts/default.aspx"
						 title="Shirts"
						 description="" /&gt;
			[siteMapNode url="~/ladies/clothing/pants/default.aspx"
						 title="Pants"
						 description="" /&gt;
		[/siteMapNode&gt;
		[siteMapNode url="~/ladies/cosmetics/default.aspx"
					 title="Cosmetics"
					 description=""&gt;
			[siteMapNode url="" title="Make-Up"/&gt;
		[/siteMapNode&gt;
		[siteMapNode url="~/ladies/models/default.aspx"
					 title="Models"
					 description=""&gt;
			[siteMapNode url="~/ladies/models/Aloree/default.aspx"
						 title="Aloree"
						 description="" /&gt;
			[siteMapNode url="~/ladies/models/Twila/default.aspx"
						 title="Twila"
						 description="" /&gt;
			[siteMapNode url="~/ladies/models/Dinnelle/default.aspx"
						 title="Dinnelle"
						 description="" /&gt;
		[/siteMapNode&gt;
		[siteMapNode url="~/contactus.aspx" title="Contact Us"/&gt;
	[/siteMapNode&gt;
[/siteMap&gt;
</pre></span>
Now, the point of this navigation structure is to seperate the navigation of two sites without creating multiple web.config files in you web app. In my web app, I wanted to build two sites within the same web app and include a structured navigation using multiple web.sitemap files inside the directories in the two sites. So, you have the main site A, then you have the two sites A1 and A2. If you need more details, let me know...

<img src ="http://blogs.clearscreen.com/raylinder/aggbug/2662.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Ray A. Linder</dc:creator><title>:: In discovery of displaying images from a SQL BLOB to a DataList ::</title><link>http://blogs.clearscreen.com/raylinder/archive/2005/09/18/2420.aspx</link><pubDate>Sun, 18 Sep 2005 15:16:00 GMT</pubDate><guid>http://blogs.clearscreen.com/raylinder/archive/2005/09/18/2420.aspx</guid><wfw:comment>http://blogs.clearscreen.com/raylinder/comments/2420.aspx</wfw:comment><comments>http://blogs.clearscreen.com/raylinder/archive/2005/09/18/2420.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/raylinder/comments/commentRss/2420.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/raylinder/services/trackbacks/2420.aspx</trackback:ping><description>:: Currently, I'm learning to display a SQL BLOG image to a datalist. I've got the uploading images as BLOB to a SQL database so far. I've found that this task has become an extremely intensified frustrating. I'll add the code to this post after it's finished. ::&lt;img src ="http://blogs.clearscreen.com/raylinder/aggbug/2420.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">:: Currently, I'm learning to display a SQL BLOG image to a datalist. I've got the uploading images as BLOB to a SQL database so far. I've found that this task has become an extremely intensified frustrating. I'll add the code to this post after it's finished. ::<img src ="http://blogs.clearscreen.com/raylinder/aggbug/2420.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Ray A. Linder</dc:creator><title>About using Club Site Starter Kit's Calendar structure...</title><link>http://blogs.clearscreen.com/raylinder/archive/2005/06/06/1842.aspx</link><pubDate>Mon, 06 Jun 2005 00:10:00 GMT</pubDate><guid>http://blogs.clearscreen.com/raylinder/archive/2005/06/06/1842.aspx</guid><wfw:comment>http://blogs.clearscreen.com/raylinder/comments/1842.aspx</wfw:comment><comments>http://blogs.clearscreen.com/raylinder/archive/2005/06/06/1842.aspx#Feedback</comments><slash:comments>20</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/raylinder/comments/commentRss/1842.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/raylinder/services/trackbacks/1842.aspx</trackback:ping><description>I figured out how to use the Club Site Starter Kit's Calendar structure and store events under the logged in username. Users now have their own events and calendars and can't see other user's events and calendars. I accomplished this simply using membership &amp;amp; profiles.&lt;br /&gt;
&lt;br /&gt;
I'll post the code once I figure out how to actually post code.
&lt;br /&gt;
&lt;br /&gt;
[ Post Updated: 11/20/2005 ]&lt;br /&gt;
&lt;br /&gt;
Here's the source:&lt;br /&gt;
&lt;br /&gt;
Page Code:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;Sub&lt;/span&gt; Page_Load(&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;As&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;Object&lt;/span&gt;, &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;ByVal&lt;/span&gt; e &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;As&lt;/span&gt; EventArgs)
        &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;Dim&lt;/span&gt; Username &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;As&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;String&lt;/span&gt;
        &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;Dim&lt;/span&gt; user &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;As&lt;/span&gt; MembershipUser
        &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;' Get the currently logged-on user and&lt;/span&gt;
        &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;' update the user's online timestamp&lt;/span&gt;
        user &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;=&lt;/span&gt; Membership.GetUser(&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;True&lt;/span&gt;)
        Username &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;=&lt;/span&gt; user.UserName
    &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;End&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;Sub&lt;/span&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
and here's what changes you need to the EventCalendar's SQLDataSource :&lt;br /&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;
&amp;lt;asp:sqldatasource id=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"SqlDataSource1"&lt;/span&gt; runat=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"server"&lt;/span&gt; connectionstring=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"&amp;lt;%$ ConnectionStrings:MyConnectionString %&amp;gt;"&lt;/span&gt; 
   selectcommand=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"SELECT [id], [starttime], [title], [description] FROM [Events] WHERE ([username] = @username)"&lt;/span&gt;&amp;gt;
         &amp;lt;selectparameters&amp;gt;
                  &amp;lt;asp:profileparameter defaultvalue=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;""&lt;/span&gt; name=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"username"&lt;/span&gt; propertyname=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"Username"&lt;/span&gt; type=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"String"&lt;/span&gt; &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;/&lt;/span&gt;&amp;gt;
         &amp;lt;/selectparameters&amp;gt;
&amp;lt;/asp:sqldatasource&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
and here's what changes you need to the GridView's SQLDataSource :&lt;br /&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;
&amp;lt;asp:sqldatasource id=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"SqlDataSource2"&lt;/span&gt; runat=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"server"&lt;/span&gt; connectionstring=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"&amp;lt;%$ ConnectionStrings:LSIMainDB %&amp;gt;"&lt;/span&gt;
   selectcommand=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"SELECT TOP 5 Events.id, Events.starttime, Events.endtime, Events.title, Locations.title AS locationname, 
   Events.username FROM Events LEFT OUTER JOIN Locations ON Events.location = Locations.id WHERE (Events.starttime &amp;gt; GETDATE())
   AND ([username] = @username) ORDER BY Events.starttime, Events.id"&lt;/span&gt;&amp;gt;
         &amp;lt;selectparameters&amp;gt;
                  &amp;lt;asp:profileparameter defaultvalue=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;""&lt;/span&gt; name=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"username"&lt;/span&gt; propertyname=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"Username"&lt;/span&gt; type=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"String"&lt;/span&gt; &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;/&lt;/span&gt;&amp;gt;
         &amp;lt;/selectparameters&amp;gt;
&amp;lt;/asp:sqldatasource&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src ="http://blogs.clearscreen.com/raylinder/aggbug/1842.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">I figured out how to use the Club Site Starter Kit's Calendar structure and store events under the logged in username. Users now have their own events and calendars and can't see other user's events and calendars. I accomplished this simply using membership &amp; profiles.<br />
<br />
I'll post the code once I figure out how to actually post code.
<br />
<br />
[ Post Updated: 11/20/2005 ]<br />
<br />
Here's the source:<br />
<br />
Page Code:<br />
<br />
<pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px">
<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">Sub</span> Page_Load(<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">ByVal</span> sender <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">As</span> <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">Object</span>, <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">ByVal</span> e <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">As</span> EventArgs)
        <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">Dim</span> Username <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">As</span> <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">String</span>
        <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">Dim</span> user <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">As</span> MembershipUser
        <span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px">' Get the currently logged-on user and</span>
        <span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px">' update the user's online timestamp</span>
        user <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px">=</span> Membership.GetUser(<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">True</span>)
        Username <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px">=</span> user.UserName
    <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">End</span> <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">Sub</span>
</span></pre>
<br />
<br />
and here's what changes you need to the EventCalendar's SQLDataSource :<br />
<pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px">
&lt;asp:sqldatasource id=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"SqlDataSource1"</span> runat=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"server"</span> connectionstring=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"&lt;%$ ConnectionStrings:MyConnectionString %&gt;"</span> 
   selectcommand=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"SELECT [id], [starttime], [title], [description] FROM [Events] WHERE ([username] = @username)"</span>&gt;
         &lt;selectparameters&gt;
                  &lt;asp:profileparameter defaultvalue=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">""</span> name=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"username"</span> propertyname=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"Username"</span> type=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"String"</span> <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px">/</span>&gt;
         &lt;/selectparameters&gt;
&lt;/asp:sqldatasource&gt;
</span></pre>
<br />
<br />
and here's what changes you need to the GridView's SQLDataSource :<br />
<pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px">
&lt;asp:sqldatasource id=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"SqlDataSource2"</span> runat=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"server"</span> connectionstring=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"&lt;%$ ConnectionStrings:LSIMainDB %&gt;"</span>
   selectcommand=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"SELECT TOP 5 Events.id, Events.starttime, Events.endtime, Events.title, Locations.title AS locationname, 
   Events.username FROM Events LEFT OUTER JOIN Locations ON Events.location = Locations.id WHERE (Events.starttime &gt; GETDATE())
   AND ([username] = @username) ORDER BY Events.starttime, Events.id"</span>&gt;
         &lt;selectparameters&gt;
                  &lt;asp:profileparameter defaultvalue=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">""</span> name=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"username"</span> propertyname=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"Username"</span> type=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"String"</span> <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px">/</span>&gt;
         &lt;/selectparameters&gt;
&lt;/asp:sqldatasource&gt;
</span></pre>
<br />
<br /><img src ="http://blogs.clearscreen.com/raylinder/aggbug/1842.aspx" width = "1" height = "1" /></body></item></channel></rss>