Monday, January 26, 2009

ListView Sample - Asp.net 3.5 C# vb with datapager

When I first did program got following error:
An item placeholder must be specified on ListView 'ListView1'. Specify an item placeholder by setting a control's ID property to "itemPlaceholder". The item placeholder control must also specify runat="server".
after google many site got help and created first ListView program using sql-server.
 
 
 
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!

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>

<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" ItemPlaceholderID="LeadRep">

<LayoutTemplate>

<div id="LeadRep" runat="server"></div>

</LayoutTemplate>

<ItemTemplate>

<div><%# DataBinder.Eval(Container.DataItem,"LeadType") %></div>

<div><%# DataBinder.Eval(Container.DataItem,"HomePhone") %></div>

</ItemTemplate>

</asp:ListView>

<asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1" PageSize="5">

<

fields><asp:nextpreviouspagerfield ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" /><asp:numericpagerfield />

<

asp:nextpreviouspagerfield ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"

ShowPreviousPageButton

="False" />

</

fields>

</

asp:DataPager>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

ConnectionString="<%$ ConnectionStrings:SalesforceConnectionString %>"

SelectCommand="SELECT * FROM [SF_TranData]"></asp:SqlDataSource>

</div>

</form>

</

body>

</

html>

Thursday, January 22, 2009

Disable Mouse While Processing Data C# asp.net vb 2.0

Works fine with master file also...
<html>
<head>
   <style type="text/css">
      .LockOff {
         display: none;
         visibility: hidden;
      }

      .LockOn {
         display: block;
         visibility: visible;
         position: absolute;
         z-index: 999;
         top: 0px;
         left: 0px;
         width: 105%;
         height: 105%;
         background-color: #ccc;
         text-align: center;
         padding-top: 20%;
         filter: alpha(opacity=75);
         opacity: 0.75;
      }
   </style>

   <script type="text/javascript">
      function skm_LockScreen(str)
      {
         var lock = document.getElementById('skm_LockPane');
         if (lock)
            lock.className = 'LockOn';

         lock.innerHTML = str;
      }
   </script>
</head>
<body>
   <h2>Overlay Test Page</h2>
   <p>
      Please enter your name:
      <input type="text" name="name" />
   </p>
   <p>
      <input type="submit" value="Click Me!" onclick="skm_LockScreen('We are processing your request...');" />
   </p>

   <div id="skm_LockPane" class="LockOff"></div>
</body>
</html>
 
 

Monday, January 19, 2009

Count Record using asp.net C# , count(*)

 SqlConnection cnn = new SqlConnection("server=DBSERVER;User id=USER;password=PASSWORD;database=DB");
  SqlCommand cmd = new SqlCommand("Select count(*) from abctest", cnn);
  cnn.Open();
  Response.Write(cmd.ExecuteScalar().ToString());

Saturday, January 17, 2009

Accesss database Error Field 'Database field' cannot be a zero-length string.

You can receive this error message if you modify the PDshop database column properties incorrectly. Most PDshop database fields (aka columns) should allow a zero-length (NULL) value.

To resolve this error, Using the Microsoft Access program, go into "Design View" for the table mentioned in the error. You would need to change the column properties for the field named in the error. For example, change the "General" setting for the column/field, the setting to change is 'Allow Zero Length', the value should be set to 'Yes'.

Friday, January 16, 2009

Open a popup Window from C# code behind asp.net 2.0

open a popup window from C# code behind

Sample:

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        //File Receiveed/Assign to Processor
        string url = "uplfile.aspx?strtxt=File Receiveed/Assign to Processor&caseno=" + Request["caseno"];
        ClientScript.RegisterStartupScript(this.GetType(), "newWindow", String.Format("<script>window.open('{0}');</script>", url));
        
        //Response.Redirect("uplfile.aspx?strtxt=File Receiveed/Assign to Processor&caseno=" + Request["caseno"]);


    }
        

Monday, January 12, 2009

Get Program Name in aspx page C#

System.IO.Path.GetFileName(Request.ServerVariables["SCRIPT_NAME"]

Thursday, January 8, 2009

Download Windows 7 beta on January 9th' 2009

January 9th PST for a limited time to the first 2.5 million people who download the beta.
 

Monday, January 5, 2009

MacBook Wheel From Apple

Apple has done it again with the announcement of the MacBook Wheel - the first laptop to get rid of the keyboard.