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

Pages

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 :)