Wednesday, December 18, 2013

IN SQL update null value

create database jitendra

create table tblEmp
(
eid int identity,
 int
)


insert into tblEmp(salry) values(100)
insert into tblEmp(salry) values(1002)
insert into tblEmp(salry) values(1020)
insert into tblEmp(salry) values(null)
insert into tblEmp(salry) values(100)
insert into tblEmp(salry) values(125)

select * from tblEmp


update tblEmp set salry=CONVERT(INT,salry,10)+200

update tblEmp set salry = case when salry IS not null  then  salry+898
                               when salry IS null then 200
                              end

Sunday, October 6, 2013

How to get radio buttn list value in Js?


if
<input name="sex" id="sex_male" type="radio" value="male">
<input name="sex" id="sex_female" type="radio" value="female">
Then
var theRadioGroup=getRadioValue("sex")
function getRadioValue(theRadioGroup)
{
    var elements = document.getElementsByName(theRadioGroup);
    for (var i = 0, l = elements.length; i < l; i++)
    {
        if (elements[i].checked)
        {
            return elements[i].value;
        }
    }
}


2nd
<script>
function getRadioValue()
{
    for (var i = 0; i < document.getElementsByName('sex').length; i++)
    {
    	if (document.getElementsByName('sex')[i].checked)
    	{
    		return document.getElementsByName('sex')[i].value;
    	}
    }
}
</script>

function getCheckedValue(radioObj) {
        if (!radioObj)
            return "";
        var radioLength = radioObj.length;
        if (radioLength == undefined)
            if (radioObj.checked)
                return radioObj.value;
            else
                return "";
        for (var i = 0; i < radioLength; i++) {
            if (radioObj[i].checked) {
                return radioObj[i].value;
            }
        }
        return "";
    };

Friday, July 5, 2013

How to play youtube video in asp.net website using javascript?




    //Play  video on Website        



   vyoutyube = youtube_parser(VidUrl)

                vyoutyube = "http://www.youtube.com/embed/" + vyoutyube;

if (vyoutyube != "") {

                        var updPostedVideodiv = document.createElement("div");
                        updPostedVideodiv.className = "update-body-upload-video";
                        updleftbg.appendChild(updPostedVideodiv);

                        var updVideoplay = document.createElement("iframe");
                        updVideoplay.setAttribute("src", vyoutyube);
                        updVideoplay.type = "application/x-shockwave-flash";
                        updVideoplay.setAttribute("autostart", true);
                        updVideoplay.setAttribute("allowfullscreen", true);
                        updVideoplay.setAttribute("loop", false);
                        updPostedVideodiv.appendChild(updVideoplay);

                        var videoDesc = document.getElementById('txtVidDesc').value;
                        var updVideoDesc = document.createElement("div");
                        updVideoDesc.className = "update-body-vide-Desc";
                        updVideoDesc.innerHTML = videoDesc;
                        updleftbg.appendChild(updVideoDesc);


                    }






           
function youtube_parser(url) {

            var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
            var match = url.match(regExp);
            if (match && match[7].length == 11) {
                return match[7];
            } else {
                alert("Youtube Url is incorrect");
            }
        }