Website Code In Asp.net That Is Dynamic
Solution 1:
You might like to investigate the UpdatePanel control. This might help you do what you need.
Solution 2:
placeholder is a very good choice for your scenario. It is useful when any user wants to bind a dynamic control and we can fix its position too. Very simple demo at : http://www.java2s.com/Code/ASP/Asp-Control/DealwithaspplaceholdercontrolfromcodebehindC.htm
Solution 3:
why not create the item on the page and when the value "computer request" is selected, hide or show it? You can do this by setting the autopostback property on your dropdownlist to true and can test against it in your code behind.
Solution 4:
If you want to do this completely in client-side code, just create the "Cost Center" row and set visibility to false
. Then wire up the onchange
event of the dropdown list to a javascript function that checks if the "Computer Request" item was selected. If it was, change the visibility to true
. (You could also use jQuery to do this).
Edit
$(document).ready(function () {
$('#yourSelectId').change(function() {
var selectedVal = $('#yourSelectId option:selected').attr('value');
if(selectedVal == computerRequestItemValue)
$('#costCenterRow').show();
else
$('#costCenterRow').hide();
});
});
Post a Comment for "Website Code In Asp.net That Is Dynamic"