Thursday 28 March 2013

How put multiple Parameter using Variable in IN Clause in Sql Server





declare @val varchar(20)
declare @sql nvarchar(200)
set @val = '''A'',''B'',''C''' --Your Prameter of Program

print @val

Set @sql='select * from SomeTable where name in ('+@val+')'
--Print @sql
exec sp_executesql @Sql -- Is used to Execute Sql query

Wednesday 13 March 2013

How to Enable Disable control using JQuery




$('#<%=DdlLocation.ClientID%>').attr('disabled', 'disabled');

How to set Selected Value of Drop Down List in Asp.net Using JQuery

1. )



$('#<%=DdlLocation.ClientID%>').val('1').attr("selected","selected");

2.)

$("#<%=DdlLocation.ClientID%> option[value='1' ] ").attr("selected","selected");

3.)


$("#<%=DdlLocation.ClientID%> option[text='c' ] ").attr("selected","selected");



 

Tuesday 15 January 2013

How Server respond when AJAX Request to the Server While one AJAX Request in Progress

Note: In my past Experience i got the scenario when one AJAX server request in Process then other AJAX request is given to server. 

Now Question arise that what will happen in that case?

Ans :- In that Case 1st one request will stopped and 2nd Request will be initialized to server on that time.

You can check with Your Self with given below Steps:

Step 1: Make AJAX Web based project and put the given below Code in body Tag of Default.aspx file.



<form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Button runat="server" Text="Button" ID ="Btn" OnClick="Btn_Click"/>
        <asp:Label runat="server" Text="Label" ID ="Lbl"></asp:Label>
    </ContentTemplate>
    </asp:UpdatePanel>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
            <ProgressTemplate>
            <asp:Label runat="server" Text="Please Wait while work in Process......" ID="Lbl2"></asp:Label>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </div>
   
   
   
    <div>

    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
    <ContentTemplate>
        <asp:Button runat="server" Text="Button" ID ="Button1" OnClick="Button1_Click"/>
        <asp:Label runat="server" Text="Label" ID ="Label1"></asp:Label>
    </ContentTemplate>
    </asp:UpdatePanel>
        <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel2">
            <ProgressTemplate>
            <asp:Label ID="Label2" runat="server" Text="Please Wait while work 2 in Process......"></asp:Label>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </div>
   
    </form>

And put the given below code in Default.cs File.


protected void Btn_Click(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(10000);
        Lbl.Text = "This is First Ajax";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //System.Threading.Thread.Sleep(10000);
        Label1.Text = "This is Second Ajax";
    }
 
  • First Button Click Response with Update Progress


 


  • On the Same time Click on Second Button then First one is Stopped and Second Request is initialized see below output Screen shot: