How to get the value of radio button in JQuery


Monday, August 2, 2010

Suppose you have group of radiobuttonlist and you need to find which radio button is checked.

So By using below code you can find, which radio button is checked in radiobuttonlist


jQuery('#ctl00_ContentPlaceHolder1_rblSort input:radio:checked').val()


or

$("#ctl00$ContentPlaceHolder1$rblSort").data("currChecked", 

$(this).find("input:radio:checked")[0]);


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer

Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com


How to get the value of session in JQuery




Sometime, its possible that you need to compare login session on clientside code only before server side.

You can achive this task by using below code.


var sessionValue = '<%= Session("UserName") %>';
if (sessionValue == 'Rajesh') 
{
Alert("This is Rajesh Singh");
}


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer

Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com


Response.Redirect in Javascript or Jquery




In C# or VB.net, if you wish to redirect page to some other page then you normally use below code

In C#
Response.Redirect("default.aspx");

and In Vb.Net
Response.Redirect("default.aspx")

But what for Javascript and Jquery, how you will use redirect feature in Javascript and Jquery ?

Here is the solution,

You can achive this Response.Redirect feature in javascript and jquery also by below code,


window.location.href = 'http://' + '<%=Request.Url.Host%>' + '/default.aspx';


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer

Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com


How to get Host Url in javascript or Jquery




Sometime, you will be in need of only host part of URL, like

if you url is http://www.induway.com/aboutus.aspx

then if you wish to have only "induway.com" out of complete url, then you can use this code to get host url
in javascript or jquery.


'<%=Request.Url.Host%>'


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer

Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com


How to fetch the querystring variable in jQuery




Suppose you are having this Querystring

http://www.induway.com/aboutus.aspx?Industry='india'

and if you wish to fetch value of Industry then you can do it like this,


if ('<%=Request("Industry")%>' != '') 
{
    alert('<%=Request("Industry")%>');
}


By using above code, you can use querystring variable value to your page anywhere.

Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer

Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com


Replace space character in between string in Jquery




Replace space character in between string in Jquery

Sometimes it possible that we need string by all space character removed, so here is the way by which we can remove space

character from our string.

For Example :

Our string is "Rajesh Singh"

var searchvalue='Rajesh Singh'
var searchvaluetemp = searchvalue.replace(/ /g, '');

Our Output will be "RajeshSingh"

Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer

Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com