"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Friday, December 16, 2011

Google Images Instance

Hi *.*,
Again Instance now 'm with Google Images :) .In my older post i had shown Youtube instance 


Demo:(Wait the image is loading...)


Tuesday, December 13, 2011

C# and VB.NET, Fundamentals: Development for Absolute Beginners

Hi *.*,
A few back i heard from my colleges that msdn.com is planning for a good video tutorial for beginners. He read from an Asp.net insiders blog. Today he sent me the link and its really cool link for both C# and vb.net developers.

Friday, December 2, 2011

Error 2 Use of unassigned local variable "[Variable name]"

Hi *.*,
Error 2 Use of unassigned local variable "[Variable name]" .Hope u faced this error before is it?.
How it come?
Before return a variable like(integer, char... etc).before using these variable it need to be initialized 


If u had any trouble just ask, Happy to help u :) 
Stay Tune... 
Have a nice day... 'N happy Coding :)

Thursday, December 1, 2011

youtube instant using Asp.net

Hi*.*,
I'm grad to announce here that.I created a YouTube instant in just 1.48 hr.i'm soooo happy. for  just  a craze started after my friend told the story abt Feross Aboukhadijeh. my friend prajeesh encouraged me to do it.After finish it passed code to my friends @ night !!!! i'm so carzy @ that moment.On morning i got a call from my friend who working on cyber crime told me don't publish the code !!!!. i got surprise y?. using that logic and alternation of code anyone can steel data from any website with out visiting.after his call i gone through wht he said.i tried. yes i'm able to download all the links in a webpage.(didn't gone through capcha page,will try it).
Then y i announce is, i feel i should announce here.but if ur webpage is entirely scripted like gmail.com and facebook.com. my code has limitation.
DEMO



Stay Tune... Have a nice day... 'N happy Coding :)

Friday, November 25, 2011

Remove Duplicate record from Table

Hi *.*,

create table #tbdemo (
id int identity(1,1),
StrName Nvarchar(50),
StrCity Nvarchar(50)
)

insert into #tbdemo values ('Arun','Kollam')
insert into #tbdemo values('Arun','Kollam')
insert into #tbdemo values('Prajeesh','Kochi')
insert into #tbdemo values('Prajeesh','Kochi')
insert into #tbdemo values('Sibi','Patnapuram')
insert into #tbdemo values('Sibi','Patnapuram')
insert into #tbdemo values('Dasapan','Kozikodi')
insert into #tbdemo values('Dasapan','Kozikodi')

select * from #tbdemo

select MIN(id) as ID from #tbdemo
GROUP BY StrName,StrCity

DELETE FROM #tbdemo
WHERE id NOT IN(select MIN(id) as ID from #tbdemo GROUP BY StrName,StrCity)


If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Thursday, November 24, 2011

Assign Value to a variable on Store Procedure

Hi *.*,
Assign Value to a variable on Store Procedure. First declare a variable with prefix '@'.Then you can use both 
SET and SELECT.

Sunday, November 20, 2011

Exporting an sql table to XML

Hi *.*,
To export data first it should be hold in a Dataset or Datatable or else where we can loop(Here i used a dataset).

Saturday, November 19, 2011

Unknown server tag 'asp:xxx'.

Hi *.*,
Its another common error seen after adding Ajax or by adding new web-config file to project.
Its happen when asp can't understand server tag !!!
Solution:
  • Remove Ajax dll from bin folder add Ajax once more ('m not recommending this)
  • Add tagprefix on webconfig.

Wednesday, November 16, 2011

ERROR: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

Hi *.*,
Yet another common error while handling with datetime in sql.Worst part of this error is on code side and sql site we had given datetime as datatype.Still its their !!!!

Saturday, November 12, 2011

Hyperlink with more than one parameter Or Error: Server tag not well Formed with Hyperlink

Hi *.*,
In my first day of .net i found this error the with the help of my senior i resolved it.Then i didn't know why it come so.2day my junior faced same issue i gone through and got why it come :).its all because when binding hyperlink with data not at just data, you have to give entire NavigateUrl the Server control. and also (single quote) and (Double quote) have to be in correct way too...

Tuesday, November 8, 2011

Sunday, November 6, 2011

javascript validation on Default Button event and passing control to server side

Hi *.*,
Heading of my post feel bit difficult to understand isit? :( .Actually i was confused to decide what should be the header of this post.Any way lets move to topic.
My friend again got trouble using default button.Now problem is he using Client-side validation then how can he perform it!!!.First i was also confused. Later i got it :).On my previous post i show how to get keyboard unicode.that helped me here.
onkeypress event of text box i'm checking whether it ENTER key hit or not !!! Now if so i will do my condition if it pass that i will pass event to server side.

Saturday, November 5, 2011

One page with multi Default Button

Hi *.*,
As part of my last post.My friend ask me whether its possible to have multi Default Button in one page. Yes it possible.

Friday, November 4, 2011

Default button and Default Focus

HI *.*,
Default button property is used to specify which button gets clicked when "ENTER" key is pressed.
and Default Focus  property is used to get focus on that control on page start-up(Just like Gmail login,Focus on Username text box and when enter button is clicked login,if valid :P )

Thursday, November 3, 2011

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Hi *.*,
This is one of the most frequently asking question on sql/asp fourms.
Reasons for this error:

  1. Make sure your connection string data are correct and only that particular string is you calling.
  2. You need to enable the listener on port 1433 in the SQL Server Configuration Manager control panel
  3. Enable the "sa" user. It's disabled by default after the install.
  4. Set a password on the "sa" user.
  5. Enable SQL Authentication + NT Authentication mode.
  6. Make sure the Windows firewall isn't blocking port 1433.
  7. Try the default instance name instead of SQLEXPRESS.
  8. Make sure the remote connection is using TCP/1433



If u had any trouble just ask, Happy to help u :) 
Stay Tune... 
Have a nice day... 'N happy Coding :)

Wednesday, November 2, 2011

Difference between GETDATE() and GETUTCDATE()

Hi *.*,
Playing with date-time is one of the biggest headache to me. :( . i faced a problem recently with that. Server is located at one place and client at another place  so what happened is the date doesn't change for 4.15 hrs!!!!.
Later v solved by adding GMT along with that.
Here i'm sharing the SQL script helped to get out of that.


Thursday, October 27, 2011

Setting column width for gridview

Hi *.*,
It sounds simple but hard part when implements.Visual studio is giving us a option to set width of header and item template .But it not work !!!! :(
After an war of 1 hour with the help of our designer we achieve it :) .
Done by adding table-layout:fixed  to gridview style and define HeaderStyle-Width="xx PX".
Game is over !!!

If u had any trouble just ask, Happy to help u :) 
Stay Tune... 
Have a nice day... 'N happy Coding :)

Monday, October 24, 2011

Show Scroll Bar using javascript

 Hi *.*,
All the modern browsers support auto scroll bar.But when we create some popup with hiding menu-bar and status-bar the browser will not provide scroll bar by considering it a malicious actions !!!!Over that case the below script will help u 


window.onload = function ()
{
 var bodyElementsArray = document.getElementsByTagName('BODY');

 if ( (bodyElementsArray != null) && (bodyElementsArray.length > 0) )
 {
  var bodyElement = bodyElementsArray[0];

  bodyElement.scroll = 'yes';
 }
}

If u had any trouble just ask, Happy to help u :) 
Stay Tune... 
Have a nice day... 'N happy Coding :)

Saturday, October 22, 2011

Javascript to hide Address/Menu Bar and open page in new window

Hi *.*,
When we plan to open a new window make sure no popup blocker will catch u :( .
Here are a few technique to create a new window over different event.
1. Onclick

<asp:HyperLink id="lnkSend" runat="server" text="Send" onclick="window.open('mytest.aspx?abc=123', 'NewWindow', 'location=no,menubar=no,status=no,toolbar=no,titlebar=no');" NavigateUrl="#"/>
2.PageLoad (Client Side)

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript" language="javascript">
        function windowOpen() {            testWindow = window.open ("http://www.google.com", "mywindow", "menubar=1,status=1,scrollbars=0,width=500,height=500");        }    </script>
</head>
<body onload="javascript: windowOpen();">
    <form id="form1" runat="server">
    <div>
        <h1>Javascript Window</h1>
    </div>
    </form>
</body>
</html>
3.PageLoad (Server Side)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
         Dim width, height, url, target, status, attributes As String
         width = "width=500"
        height = "height=500"
        target = "_new"
        url = "http://www.Simplyasp.blogspot.com"
        status = "status=0"
        attributes = width & ", " & height & ", " & target & ", " & status         Dim js As String = "<script>window.open('" & url & "','" & target & "', '" & attributes & "');</script>"
        ClientScript.RegisterStartupScript(GetType(Page), "Launch_New_Window", js)    End If
End Sub


 4.Open page in new window (DON'T HIDE  Address/Menu Bar)

<asp:HyperLink ID="Hyperlink1" runat="server" NAME="Hyperlink1" Target="_blank" ></asp:HyperLink>



If u had any trouble just ask, Happy to help u :) 
Stay Tune... 
Have a nice day... 'N happy Coding :)

Mapping url over image

Hi *.*,
I know its basic Still it had its important because of that i'm publishing it again here.


<a href='<%# "AgencyVouchers.aspx?id=ORB" + DataBinder.Eval(Container.DataItem,"booking-ID").ToString()%>'>
<asp:Image ImageUrl="~/MainPages/images/ggggg_05.png" ID="imgprint" runat="server" /></a>



If u had any trouble just ask, Happy to help u :)
 Stay Tune... 
Have a nice day... 'N happy Coding :)

String.Format in asp.net c#

 Hi *.*,

 Asp.net support formatting string, but unfortunately i can't find any useful link in msdn :( . Later i googled the stuff. I'm so happy i got more than i need :)
Here i'm suggesting some link that can help to improve your knowledge this:
  • http://blog.stevex.net/string-formatting-in-csharp/
  • http://idunno.org/archive/2004/07/14/122.aspx
  • http://blog.stevex.net/2007/09/string-formatting-faq/
go through both articles and comment


If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Monday, October 10, 2011

Conditionally enabling and disabling dropdown using jquery

Hi *.*,
2day i'm showing enable/disable dropdownlist through checkbox selection using Jquery 
Code

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>DEMO BY SIMPLYASP.BLOGSPOT.COM</title>
    <script src="Script/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#chkbox").click(function () {
                if (this.checked)
                    $('#DrpList').attr('disabled', 'disabled');
                else
                    $('#DrpList').removeAttr('disabled');
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:CheckBox ID="chkbox" runat="server" Text="Enable/Disable" /><br />
        <asp:DropDownList ID="DrpList" runat="server">
            <asp:ListItem Text="Select" Value="-1"></asp:ListItem>
            <asp:ListItem Text="Option1" Value="1" />
            <asp:ListItem Text="Option2" Value="2" />
            <asp:ListItem Text="Option3" Value="3" />
        </asp:DropDownList>
    </div>
    </form>
</body>
</html>





If u had any trouble just ask, Happy to help u :)
Stay Tune... 
Have a nice day... 'N happy Coding :)

Tuesday, October 4, 2011

Change the font color based on the value in dropdownlist in asp.net c#

 Hi *.*,
2day i'm showing some css magic on dropdown list.
demo
 
How to Implement?

On html


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Change the font color based on the value in dropdownlist in asp.net c#</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:DropDownList ID="ddpdown" runat="server" >
    </asp:DropDownList>
    </div>
    </form>
</body>
</html>
 

 On Server Side


   protected void Page_Load(object sender, EventArgs e)
    {
        for (int _i = 0; _i < 10; _i++)
        {
           
            if (_i <5)
            {
                ddpdown.Items.Add(_i.ToString()+" - Not Avilable");
                ddpdown.Items[_i].Attributes.CssStyle.Add("color", "red");
            }
            else
            {
                ddpdown.Items.Add(_i.ToString()+" - Avilable");
                ddpdown.Items[_i].Attributes.CssStyle.Add("color", "green");
            }
           
        }
    }
 
Hope u got it...
Stay Tune...
Have a nice day... 'N happy Coding :)