tags:

views:

178

answers:

1

hi guys, I have 2 buttons and 2 divs div1 and div2.On click button1 div1 is made visible and div2 invisible,On clicking button2 div2 is made visible and div1 is invisible.

For that i used javascript.

function showdiv2()
{
    document.getElementById("div2").style.visibility="visible";
    document.getElementById("div2").style.display="inline";
    document.getElementById("div1").style.visibility="hidden";
    document.getElementById("div1").style.display = "none";
    document.getElementById("lbl_msg").innerHTML = ""
}

function showdiv1()
{
    document.getElementById("div1").style.visibility="visible";
    document.getElementById("div1").style.display="inline";
    document.getElementById("div2").style.visibility="hidden";
    document.getElementById("div2").style.display = "none";
    document.getElementById("lbl_msg").innerHTML = ""
}

In div2 i have a gridview in which i have a linkbutton named lnkDelete.In its click control is going to div1.In click of lnkDelete,i want to make div1 invisible,but on clicking button1 div1 should be visible.Can anybody help to make div1 invisible in clickevent of lnkDelete in codebehind?

A: 

You can write

div1.Style["DISPLAY"] = "inline";

in C#.

In your javascript code you can either use display property or visibility property, no need to use both of them.

rahul
what code i need to write in codebehind using Page.registerstartupscript to make div1 invisible
If I understood what you want to do, you want to make DIV 1 invisible when the click event occurs on the button. If that's what you want, you can use this in the callback function of the button "onclick" (server-side) event:div1.Style["display"] = "none";You'll affect DIV's style property "display" to "none" and that'll make DIV invisible (although it is still rendered).
XpiritO