I have 7 textbox and 7 corresponding checkbox if user input in any of the text box its particular checkbox should get tick and selected textboxes text will be posted for query by click of a Search button how to do it..via C#.net? which method or event should i use to check for this condition. Is i have to do it on page_load event with viewstate? Suggest me what to do thanks in advance...
Searching Filters Title 开发者_如何学Go Description Category * Location Sources Keywords Date From * * Date Upto * * *to detect the input text change, you can do that with the help of JQuery. u should look at http://api.jquery.com/change/ here for .change() method for text inputs.
EDIT :
here is an on-the-fly example;
<html>
<head>
<title>JQuery Test</title>
</head>
<body>
Name : <input type="text" id="txtName" /> <input type="checkbox" id="chxName" /><br/><br/>
Surname : <input type="text" id="txtSurname" /> <input type="checkbox" id="chxSurname" /><br/><br/>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#txtName').change(function(){
var poo = $(this).val();
var foo = $('#chxName');
if(poo == 'bar'){
if(!foo.is(':checked')) {
foo.attr('checked','checked');
}
} else {
if(foo.is(':checked')) {
foo.removeAttr('checked');
}
}
});
});
</script>
</body>
</html>
run this example and enter 'bar' inside the first textbox. u will see the first checkbox has been ticked. then enter another word except 'bar'. u will see the first checkbox has been unticked.
Also you can consider some of the other jQuery events like keyup, keydown or keypress
精彩评论