TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rulec444
NA
81
0
Calling a Javascript function from C# class
Jan 17 2006 12:08 PM
For some reason I can't figure out what I'm doing wrong on this - despite several things I've found on the internet.
I'm trying to adjust the size of the page based on information selected prior to the page load or upon a selected change in a dropdown. I have the controls in cells and rows in a table.
This is part of the aspx code:
<script language="Javascript">
function rowTestHide()
{ rowTest.style.display="none"; }
function rowTestShow()
{ rowTest.style.display="block"; }
</script>
Then in the .cs file, I've tried:
1. adding this - protected System.Web.UI.WebControls.Literal useJS;
then in the Page_Load and SelectedIndexChange methods, I've put:
.....
useJS.Text="<script language='javascript'>rowTestHide()</script>";
--this errors when hit
2. Just adding in the Page_Load and SelectedIndexChange methods:
Javascript:rowTestHide();
--this errors when hit
3. Or I tried this:
String scriptString = "<script language=JavaScript> " ;
scriptString += "function rowTestHide(){";
scriptString += "rowTestHide.style.display='none';}";
scriptString += "</script>";
Response.Write(scriptString);
--this also errors when I try it
As you can probably see, I don't know what I'm doing. This seems that it would be siimple enough, but I haven't figured it out.
Thanks for your help.
Reply
Answers (
1
)
create xml dynamically for client in asp.net
Datagrid