954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

set focus issue in asp.net project..

hi

please help me to do that..

i have one form in asp.net.
In that, i have one dropdownlist box control

and near that one linkbutton "Add",
one hidden textbox is there.

when i click on Add button dropdown will hide and show textbox in their place.

i want to setfocus on that textbox without refreshing page or reloading page.

i have problem with refreshing contain after click on "Add".

so please help me to avoid this reloading or refreshing.

thanks in advance.


jack

jackparsana
Junior Poster in Training
54 posts since Sep 2010
Reputation Points: 10
Solved Threads: 1
 

server side controls are meant to set off the post-back event (which is the refresh).. if you need a client side operation (i.e. to hide/show an object), then use standard html button with javascript inbuilt as an onclick event

jfarrugia
Junior Poster
113 posts since May 2011
Reputation Points: 17
Solved Threads: 17
 

Yeah javascript is your way. Turn off the AutoPostback I.E. AutoPostback=False
and write down a small snipet of JavaScript code and call it in the program.

NETProgrammer
Light Poster
49 posts since May 2011
Reputation Points: 7
Solved Threads: 5
 

use javascript for showhide dropdown and textbox...Using javascript you can change it without refreshing page.
document.getElementById("<%=txtShipping.ClientID%>").style.display = "none";
document.getElementById("<%=dropdownShipping.ClientID%>").style.display = "";

crishlay
Junior Poster
132 posts since May 2010
Reputation Points: 10
Solved Threads: 16
 
use javascript for showhide dropdown and textbox...Using javascript you can change it without refreshing page. document.getElementById("<%=txtShipping.ClientID%>").style.display = "none"; document.getElementById("<%=dropdownShipping.ClientID%>").style.display = "";


Thanks for reply all

@crishlay :

<%=txtShipping.ClientID%>

What is ClientID?

please help me.


Jack

jackparsana
Junior Poster in Training
54 posts since Sep 2010
Reputation Points: 10
Solved Threads: 1
 

on button click..

$("ddl").hide();
$("txtShow").show();
$('txtShow').focus();

dont forget to download jquery and
dont forget to add jquery refrence in your page !

hope that helps

dnanetwork
Practically a Master Poster
Banned
633 posts since May 2008
Reputation Points: 28
Solved Threads: 106
 

Oh... I find solution...

thanks dnanetwork

thank you very much..

jackparsana
Junior Poster in Training
54 posts since Sep 2010
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: