-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Vishal
Message 1 in Discussion
Hi I want to use javascript in my asp.net pages. Following is code for my page
Pls help me how to do this, bcoz it throws error when running this code(javascript
error) See onfocus and onblur event of textbox. How can i do it. <HR
width="100%">
<TABLE class="OutlineTable" id="tblControlsArea" cellSpacing="0" cellPadding="5"
border="1" runat="server">
<TR>
<TD>
<asp:Label id="lblLocationCd" Runat="server" EnableViewState="False">Location
Code:</asp:Label></TD>
<TD>
<asp:DropDownList id="cmbLocation" CssClass="generalCbo" Runat="server"
TabIndex="1" Width="150" onchange="javaScript:ClearControls()"
onfocus="javaScript:setStatusMsg('Select an Item from the List')"
onblur="javaScript:clearStatusMsg()"></asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvLocation" Enabled="True" Runat="server"
ControlToValidate="cmbLocation" ErrorMessage="Location Code cannot be blank"
Display="None"></asp:RequiredFieldValidator>
</TD>
</TR> <!-- Second Row -->
<TR>
<TD>
<asp:Label id="lblBlockCd" Runat="server" EnableViewState="False">Block
Code:</asp:Label></TD>
<TD>
<asp:TextBox id="txtBlockCd" tabIndex="2" CssClass="GeneralTxt" Runat="server"
Width="130" onfocus="javaScript:setStatusMsg('Enter a maximum of 15 characters')"
onblur="javaScript:clearStatusMsg()" MaxLength="15"></asp:TextBox>
<img id="imgBlock" runat="server"
src="../../../Components/Images/LOV_Img.bmp" onclick="javascript:Open();">
<asp:RequiredFieldValidator ID="rfvBlockCd" Enabled="True" Runat="server"
ControlToValidate="txtBlockCd" ErrorMessage="Block Code cannot be blank"
Display="None"></asp:RequiredFieldValidator>
</TD>
</TR> <!-- Third Row -->
<TR>
<TD>
<asp:Label id="lblBlockDesc" Runat="server" EnableViewState="False">Block
Desc:</asp:Label></TD>
<TD colSpan="2">
<asp:TextBox id="txtBlockDesc" tabIndex="3" CssClass="GeneralTxt" Runat="server"
Width="400" onfocus="javaScript:setStatusMsg('Enter a maximum of 60 characters')"
onblur="javaScript:clearStatusMsg()" MaxLength="60"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvBlockDesc" Enabled="True" Runat="server"
ControlToValidate="txtBlockDesc" ErrorMessage="Block Description cannot be blank"
Display="None"></asp:RequiredFieldValidator>
</TD>
</TR>
</TABLE> <asp:ValidationSummary ID="vsErrorList" HeaderText="The following errors
occured: " ShowSummary="False" ShowMessageBox="True"
Runat="server"></asp:ValidationSummary>
<script language="javascript">
var index=0;
var strLoc="";
function BaseVariables()
{
var strCode;
var strDescription;
var strLocation;
}
function Open()
{
var strUrl;
var strFeatures;
if(document.all("Base_pgContent_cmbLocation"))
{
index = document.all("Base_pgContent_cmbLocation").selectedIndex;
strLoc=document.all("Base_pgContent_cmbLocation").options[index].value;
}
//alert("");
strUrl =
'../../../LOV/LOVContainer/LOVContainer.aspx?displaypage=../GeneralAdmin/BlockMaster/LOVBlockMaster.aspx¶meter_cd='
+ strLoc;
strFeatures = 'dialogHeight: 400px; dialogWidth: 400px; edge:Raised; center:Yes;
help: no; resizable: No; status: no';
window.showModalDialog(strUrl,BaseVariables,strFeatures);
if(BaseVariables.strCode)
{
document.all("Base:pgContent:txtBlockCd").value = BaseVariables.strCode;
document.all("Base:pgContent:txtBlockDesc").value = BaseVariables.strDescription;
fnSetComboValue(BaseVariables.strLocation);
}
}
function fnSetComboValue(value)
{
var objcombo;
var intOptionLength;
var intIterator;
objcombo = document.all("Base_pgContent_cmbLocation")
intOptionLength = objcombo.options.length;
if(intOptionLength>0)
{
for(intIterator=0;intIterator<intOptionLength;intIterator++)
{
if(objcombo.options[intIterator].value==value)
{
objcombo.options[intIterator].selected=true;
break;
}
}
}
else
{
objcombo.options.length=intOptionLength+1;
objcombo.options[0].value=value;
objcombo.options[0].text=value;
objcombo.options[0].selected=true;
}
}
function ClearControls()
{
document.all("Base_pgContent_txtBlockCd").value="";
document.all("Base:pgContent:txtBlockDesc").value = "";
}
</script>
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]