Hello Expert,
This is bascially a javascript question:
Here is my ASCX user control code in asp.net.
-----------------------------------------------------------------------------------------
<!-- VALADATION JAVASCRIPT IN HELPERFUNCTIONS.JS FILE-->
<script language="JavaScript">
function KeyUp1(what) {
if (what.value.length >= 3)
document.all("txtContactPhone_idExchange").focus();
}
function KeyUp2(what) {
if (what.value.length >= 3)
document.all("txtContactPhone_idLastFour").focus();
}
</script>
<asp:textbox id="idAreaCode" title="Enter Phone Area Code Number" runat="server" maxlength="3"
width="40" onKeyUp="javascript: KeyUp1(this);"></asp:textbox>
<b>-</b>
<asp:textbox id="idExchange" title="Enter Phone Exchange Number" runat="server" maxlength="3"
width="40" onKeyUp="javascript: KeyUp2(this);"></asp:textbox>
<b>-</b>
<asp:textbox id="idLastFour" title="Enter Phone Last Four Number" Runat="server" MaxLength="4"
width="45"></asp:textbox>
<asp:Label ID="lblExt" Runat="server" text=" Ext:"></asp:Label><asp:textbox id="idExt" title="Enter Phone Extension Number" Runat="server" MaxLength="5" columns="5"
width="45"></asp:textbox>
-------------------------------------------------------------------------
I am doing auto tabbing for phone number user control.
i want the javascript to be more generic.
for eg: document.all("txtContactPhone_idExchange").focus();
txtcontactphone is the usercontrol name on my asp page.
idexchange is the textbox name on the ascx -usercontrol page
If i want to use same user control mutiple times on the same aspx page, i have to provide different names to the control for use.
so basically i cannot hard the usercontrol name here in the ascx control.
can any one help me out.
thanks
--------------------------
<!-- VALADATION JAVASCRIPT IN HELPERFUNCTIONS.JS FILE-->
<script language="JavaScript">
function KeyUp1(what, vname) {
if (what.value.length >= 3)
document.all(vname).focus(
}
function KeyUp2(what, vname) {
if (what.value.length >= 3)
document.all(vname).focus(
}
</script>
--------------------------
-tushar