This is my Technical area of troubleshooting and learning new Programming skills and many more. Here you will find answers for many new technologies like asp.net 2.0/3.5,4.0 C# access, mysql, Amazon Webservice ,Sql-server, JD Edwards, SAS, Salesforce, APIs, MVC and many more. please visit & discuss.
Monday, June 29, 2009
Friday, June 26, 2009
Quotation in where condition sql-server
Windows 7 Upgrade
Windows 7 will be available on October 22. It includes tons of little refinements—
and a few big ones—many suggested by you. The result? Everyday computing is
faster, simpler, easier.
Order Now Your Upgrade Version Save more then $100.
Windows7 Home Premium Upgrade
Windows7 Professional Upgrade
Thursday, June 25, 2009
Wednesday, June 24, 2009
Twitter asp.net 2.0, C# sample
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><
html xmlns="http://www.w3.org/1999/xhtml" ><
head runat="server"> <title>Untitled Page</title></
head><
body> <form id="form1" runat="server"> <div> <table style="width: 50%" align="center"> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right"> <asp:Label ID="Label2" runat="server" Text="User Id:"></asp:Label></td> <td> <asp:TextBox ID="txtusrid" runat="server" Width="144px"></asp:TextBox> </td> <td> </td> </tr> <tr> <td align="right"> <asp:Label ID="Label3" runat="server" Text="Password:"></asp:Label></td> <td> <asp:TextBox ID="txtpass" runat="server" TextMode="Password"></asp:TextBox></td> <td> </td> </tr> <tr> <td align="right" style="height: 40px"> <asp:Label ID="Label1" runat="server" Text="Messages:"></asp:Label></td> <td style="height: 40px"> <asp:TextBox ID="txtmessage" runat="server" TextMode="MultiLine" Width="259px" Height="99px"></asp:TextBox> </td> <td style="height: 40px"> </td> </tr> <tr> <td style="height: 21px"> </td> <td style="height: 21px"> <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" /> <asp:Label ID="Label4" runat="server" Width="126px"></asp:Label></td> <td style="height: 21px"> </td> </tr> </table> </div> </form></
body>using
System;using
System.Net;using
System.Web;using
System.IO;public
partial class Default5 : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){
}
public void SubmitUserMsg(string username, string passwd, string txttweet){
string user = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(username + ":" + passwd)); byte[] bytes = System.Text.Encoding.ASCII.GetBytes("status=" + txttweet); HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://twitter.com/statuses/update.xml");request.Method =
"POST"; request.ServicePoint.Expect100Continue = false;request.Headers.Add(
"Authorization", "Basic " + user);request.ContentType =
"application/x-www-form-urlencoded";request.ContentLength = bytes.Length;
Stream reqStream = request.GetRequestStream();reqStream.Write(bytes, 0, bytes.Length);
reqStream.Close();
Label4.Text =
"Message Posted";}
protected void Button1_Click(object sender, EventArgs e){
SubmitUserMsg(txtusrid.Text, txtpass.Text, txtmessage.Text);
}
}
Tuesday, June 23, 2009
Error: Sys.WebForms.PageRequestManagerParserErrorException:
Error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
HTML Editor ajax toolkit 3.5 vs 2008 Sample
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><%
@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><%
@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="HTMLEditor" %><
html xmlns="http://www.w3.org/1999/xhtml"><
head runat="server"> <title>Untitled Page</title></
head><
body> <form id="form1" runat="server"><
div> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <script type="text/javascript"> </script> <asp:UpdatePanel ID="updatePanel1" runat="server"> <ContentTemplate> <HTMLEditor:Editor runat="server" Id="editor" Height="300px" AutoFocus="true" Width="100%" /> <br /> <asp:Button runat="server" Text="Submit content" ID="submit" onclick="submit_Click" /> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> </asp:UpdatePanel> </div> </form></
body></
html>Monday, June 22, 2009
Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. error
<ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" />
Sunday, June 21, 2009
What is Google Wave?
Friday, June 19, 2009
How to generate serial Number in DataList? asp.net
How to generate serial Number in DataList?
<asp:TemplateField HeaderText="SLr.No">
<ItemTemplate>
<asp:Label ID="lbSnNo" runat="Server" Text='<%# Container.ItemIndex + 1 %>' />
</ItemTemplate>
</asp:TemplateField>
How to Define style in code behind C#?
Active desktop recovery problem
Line 65
Char 1
file:///C:/Documents%20and%20Settings/My%20Name/Application%20Data/Microsoft/Internet%20Explorer/Desktop.htt"
Thursday, June 18, 2009
Newsletter sample template using access database , C# and smtp
Newsletter format using access database , C# and smtp <%@ Page Language="C#" AutoEventWireup="true" CodeFile="nl1.aspx.cs" Inherits="nl1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; " id="maintabl" runat="server"> <tr> <td colspan="1" align="center" > <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Send" /></td> </tr> <tr> <td valign="top"> <asp:Label ID="Label1" runat="server" Text="Label" BackColor="Transparent" Width="100%"></asp:Label><br /> <br /> <br /> </td> </tr> <tr> <td colspan="1" style="height: 20px" align="center" > <asp:Label ID="labmsg" runat="server"></asp:Label></td> </tr> </table> <br /> <br /> <br /> <br /> </div> </form> </body> </html> Code Behind...... using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.OleDb; using System.Web.Mail; public partial class nl1 : System.Web.UI.Page { string dynTable = ""; protected void Page_Load(object sender, EventArgs e) { string connectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=c:\\xxxx\\database\\MailDB.mdb"; OleDbConnection myOleDbConnection = new OleDbConnection(connectionString); OleDbCommand myOleDbCommand = myOleDbConnection.CreateCommand(); string ProdTy = "M2"; string Strsql = "SELECT top 5 * from DetailURLMisc "; myOleDbCommand.CommandText = Strsql; myOleDbConnection.Open(); OleDbDataReader myOleDbDataReader = myOleDbCommand.ExecuteReader(); myOleDbDataReader.Read(); dynTable = "<table align=\"center\" width=\"95%\" cellspacing=\"0\" cellpadding=\"3\" border=\"1\">"; dynTable += "<tr><td height=\"50px\" style=\"background-color:Blue\" colspan=\"3\">" +"<a href=\"default.aspx\" style=\"text-decoration: none\"><font class=\"X-small\"" +"color=\"gold\" size=\"6\"><font color=\"red\" face=\"Monotype Corsiva\">Header</font></font></a>" + "</td></tr>"; dynTable += "<tr><td height=\"25px\" style=\"background-color:Silver\" colspan=\"3\">Header2</td></tr>"; dynTable += "<tr>"; dynTable += "<td width=\"20%\"> 1</td>"; dynTable += "<td width=\"50%\" valign=\"top\">President Barack Obama's plan to transform the Federal Reserve into a super-regulator ran into skepticism Thursday from lawmakers who worry that the central bank is not the best suited to keep an eye on firms deemed so big and influential that their demise could hurt the economy.</td>"; dynTable += "<td width=\"30%\">"; while (myOleDbDataReader.Read()) { //dynTable += "<td>"+(myOleDbDataReader["TextUrl"].ToString())+"</td>"; dynTable += "<a href=" + myOleDbDataReader["NameUrl"].ToString() + "><img border=0 src=" + (myOleDbDataReader["ImageUrl"].ToString()) + "xxx></img></a>" + "<a href=" + myOleDbDataReader["NameUrl"].ToString() + ">" + (myOleDbDataReader["TextUrl"].ToString()) + "</a><br/>"; } dynTable += "</td></tr>"; dynTable += "<tr><td height=\"25px\" style=\"background-color:Silver\" colspan=\"3\"> Footer</td></tr>"; dynTable += "</table>"; Label1.Text = dynTable.ToString(); } void sndmail() { MailMessage oMessage = new MailMessage(); oMessage.To = "xxxxxx@gmail.com"; oMessage.From = "vvvvv@xxxxxx.net"; System.Text.StringBuilder sb = new System.Text.StringBuilder(); oMessage.Subject = "Great Find"; oMessage.Body = dynTable; oMessage.BodyFormat = MailFormat.Html; //oMessage.Attachments = txtBody.Text; //Response.Write("http://www.visli.com/" + System.IO.Path.GetFileName(Request.Url.ToString())); oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2; oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = "mail.xxxxx.net"; oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "kkkkk@xxxxxx.net"; //oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "xxxxx"; oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1; System.Web.Mail.SmtpMail.SmtpServer = "mail.xxxxxx.net";// try { oMessage = oMessage; System.Web.Mail.SmtpMail.Send(oMessage); labmsg.Text = "Message Send"; } catch (Exception Ex) { labmsg.Text = ("Unable to send mail! " + Ex.Message); } } protected void Button1_Click(object sender, EventArgs e) { //Label2.Text = maintabl; sndmail(); } } |
Wednesday, June 17, 2009
Tuesday, June 16, 2009
Monday, June 15, 2009
Gridview Template, Data-Binding in a Template asp.net
Gridview Template, Data-Binding in a Template asp.net
<Columns>
<asp:BoundField DataField="EmployeeID" HeaderText="Employee ID" ReadOnly="true"/>
<asp:BoundField DataField="FirstName" HeaderText="First Name"/>
<asp:BoundField DataField="LastName" HeaderText="Last Name"/>
<asp:TemplateField HeaderText="Birth Date">
<ItemTemplate>
<asp:Label ID="BirthDateLabel" Runat="Server"
Text='<%# Eval("BirthDate", "{0:d}") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:Calendar ID="EditBirthDateCalendar" Runat="Server"
VisibleDate='<%# Eval("BirthDate") %>'
SelectedDate='<%# Bind("BirthDate") %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField Text="Show Detail"
DataNavigateUrlFormatString="~/ShowEmployeeDetail.aspx?EmployeeID={0}"
DataNavigateUrlFields="EmployeeID" />
</Columns>
Source: http://msdn.microsoft.com/en-us/library/ms228046.aspx
Friday, June 12, 2009
RSS Feed, Affiliate Link Capture on Same Page - C#
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<script language = "C#" runat="server">
ICollection CreateDataSource()
{
DataTable dt = new DataTable();
DataRow dr;
dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
for (int i = 0; i < 10; i++)
{
dr = dt.NewRow();
dr[0] = "Item " + i.ToString();
dt.Rows.Add(dr);
}
DataView dv = new DataView(dt);
return dv;
}
void Page_Load(Object sender, EventArgs e)
{
if (!IsPostBack)
{
DataList1.DataSource = CreateDataSource();
DataList1.DataBind();
}
}
void Button_Click(Object sender, EventArgs e)
{
if (DataList1.Items.Count > 0)
{
Label1.Text = "The Items collection contains: <br />";
foreach(DataListItem item in DataList1.Items)
{
Label1.Text += ((DataBoundLiteralControl)item.Controls[0]).Text +
"<br />";
}
}
}
</script>
<head runat="server">
<title>DataList Items Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>DataList Items Example</h3>
<asp:DataList id="DataList1" runat="server"
BorderColor="black"
CellPadding="3"
Font-Names="Verdana"
Font-Size="8pt">
<HeaderStyle BackColor="#aaaadd">
</HeaderStyle>
<AlternatingItemStyle BackColor="Gainsboro">
</AlternatingItemStyle>
<HeaderTemplate>
Items
</HeaderTemplate>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "StringValue") %>
</ItemTemplate>
</asp:DataList>
<br /><br />
<asp:Button id="Button1"
Text="Display Contents of Items Collection"
OnClick="Button_Click"
runat="server"/>
<br /><br />
<asp:Label id="Label1"
runat="server"/>
</form>
</body>
</html>
Sourcse: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datalist.items.aspx
Thursday, June 11, 2009
Wednesday, June 10, 2009
Redirect URL using 301 redirection for affiliate Marketing
Redirect URL using 301 redirection for affiliate Marketing
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", NEW_URL);
}
Method 2.
protected void Application_BeginRequest(Object sender, EventArgs e)
{
string sOldPath = HttpContext.Current.Request.Path.ToLower();
string sPage = "http://www.aspcode.net/articles/" + sOldPath;
Response.Clear();
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location",sPage);
Response.End();
}
Method 3.
protected override void OnInit(EventArgs e)
{
int i = Request.Url.ToString().IndexOf("www.");
if (i < 8 && i != -1)
{
Response.Clear();
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", Request.Url.ToString().Remove(i, 4));
Response.End();
}
base.OnInit (e);
}
Tuesday, June 9, 2009
Google Checkout Custom Control
Google recently introduce Google Checkout. "Google Checkout is a checkout process that you integrate with your website, enabling your customers to buy from you quickly and securely, using a single username and password. Once they do, you can use Google Checkout to charge their credit cards, process their orders, and receive payment in your bank account."
They currently have no ASP.NET examples posted on their site so I have created an ASP.NET 2.0 Custom Web Control that will allow you to easily integrated with their service by simply dropping a control on the page a specifying a few parameters. So here it is...
http://www.c-sharpcorner.com/UploadFile/jlf0002/googlecheckoutcustomcontrol08072006134735PM/googlecheckoutcustomcontrol.aspx