Accessing Div statement in the code behind file ? URGENT!! [Resolved]

Posted by .Netlearner under ASP.NET on 8/9/2012 | Points: 10 | Views : 2279 | Status : [Member] | Replies : 8
 function SelectDiv()
{
document.getElementById("modalsuccess").style.display="block";
}


want to execute this java script function on the code behind file how can this be done please guide me its very urgent




Responses

Posted by: .Netlearner on: 8/9/2012 [Member] Starter | Points: 25

Up
0
Down

Resolved
modalsuccess.Style["display"] = "block";


Thanks a lot. Above code is working :)

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: .Netlearner on: 8/9/2012 [Member] Starter | Points: 25

Up
0
Down
modalsucces is the id of the div statement.While inserting data in the database am checking whether the data properly inserted and then with the return value i want to display the message as required within this div statement and This must be executed in the codebehind page.Please guide me i dont know whats the syntax used to call the java script function from the code behind file.Anyone please guide me

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 8/9/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Try this
    <div id="modalsuccess" runat="server">

// Your content
</div>

C# Code
modalsuccess.Visible = true; 


.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: .Netlearner on: 8/9/2012 [Member] Starter | Points: 25

Up
0
Down
I have tried this but no use . we want to mention display property of the div statement as block. I tried

modalsuccess.style["display"]="block";


This also didnt work .

I googled but i didnt get the exact syntax,

 Page.RegisterClientScriptBlock(this().GetType(), "ShowDiv();");
i tried something like this but the syntax is wrong. Please guide me how to call the javascript function from the code behind page


.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 8/9/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
@.Netlearner
Please try my above code.

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: .Netlearner on: 8/9/2012 [Member] Starter | Points: 25

Up
0
Down
Hello Ranjeet,

I tried that code but its not working.

Thanks For your reply

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 8/9/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
please share ur sample page.
or
try this again
HTML Page
    <div id="modalsuccess" runat="server" visible="false" >

// Your content
</div>

    protected void Button1_Click(object sender, EventArgs e)

{
modalsuccess.Visible = true;
}


.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 8/9/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
@.Netlearner
Mark As Answer, if my post helps u.

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response