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
Rohini Shirke
NA
46
31.1k
fire onchange event of dropdownlist on page load
Nov 21 2013 3:29 AM
Hi...
I have create view in asp.net mvc4.
In my view there is one dropdown:
@Html.DropDownList("Type", new SelectList(TypeList, "value", "text"), new { id = "ddl1", onchange = "SelectedIndexChanged()" })
In javascript:
<script type="text/javascript">
function SelectedIndexChanged() {
var value = $("#ddl1").val();
alert(value);
if (value == "type1")
{
document.getElementById('tblsat').style.visibility = "visible";
document.getElementById('tblSuper').style.visibility = "hidden";
}
else
{
document.getElementById('tblSuper').style.visibility = "visible";
document.getElementById('tblsat').style.visibility = "hidden";
}
}
</script>
At runtime if i change dropdown selection onchange event will work fine..But i want to fire onchange event on page load also.
Thanks..
Reply
Answers (
2
)
separate last 3 words & first 2 words from a string
can't insert records into database