Click here to Skip to main content
15,922,584 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: validate button in datagrid Pin
yesu prakash22-Nov-06 18:01
yesu prakash22-Nov-06 18:01 
QuestionHow to make this Pin
Sandeep Akhare21-Nov-06 21:23
Sandeep Akhare21-Nov-06 21:23 
QuestionSave cookies only on client side Pin
Runno12321-Nov-06 21:15
Runno12321-Nov-06 21:15 
AnswerRe: Save cookies only on client side Pin
Guffa21-Nov-06 21:35
Guffa21-Nov-06 21:35 
AnswerRe: Save cookies only on client side Pin
coolestCoder21-Nov-06 23:25
coolestCoder21-Nov-06 23:25 
QuestionProblem regarding Temporary Internet files Pin
BabuChellathurai21-Nov-06 20:58
BabuChellathurai21-Nov-06 20:58 
AnswerRe: Problem regarding Temporary Internet files Pin
Anshuman Singh22-Nov-06 0:10
Anshuman Singh22-Nov-06 0:10 
Questioncustom javascript validation for form Pin
playout21-Nov-06 20:54
playout21-Nov-06 20:54 
Hi,

I am having problems firing a javascript function on an asp.net page. I add the onclick event to the button, but the event does not fire.

Here is my code:

VB

btnSubmit.Attributes.Add("onclick", "val_update(" & Me.drpLocations.ClientID.ToString & "," & Me.drpStatus.ClientID.ToString & "," & Me.txtUserLoginName.ClientID.ToString & "," & Me.Form.ClientID.ToString & ");")


ASPX

<br />
<br />
<script language="javascript" type="text/javascript"><br />
<br />
var msgInvalid = "Not validated"<br />
<br />
function val_update(valLocation, valStatus, valUser, valForm){<br />
    if (valStatus.selectedIndex == 2 && valLocation.selectedIndex == 0) {<br />
    msg = "You need to add a Location"<br />
    alert(msg);<br />
    return false; }  <br />
    if (valUser.value = "") {<br />
    msg = "You need to add a UserName"<br />
    alert(msg);<br />
    return false;<br />
    } else {<br />
    alert(msgInvalid);<br />
    return false }<br />
<br />
}<br />
<br />
</script><br />
<br />
'button here - normal button with ID, runat command, and text.<br />
<asp:Button ID="btnInsert" runat="server" Text="Insert User" /><br />
<br />


Every time I click the button, the else statement gets processed, and "Not fired" is alerted. Not sure what I am doing wrong. Is there any way how I can do the above validation client-side?
AnswerRe: custom javascript validation for form Pin
Guffa21-Nov-06 21:00
Guffa21-Nov-06 21:00 
GeneralRe: custom javascript validation for form Pin
playout21-Nov-06 21:12
playout21-Nov-06 21:12 
AnswerRe: custom javascript validation for form Pin
Guffa21-Nov-06 21:38
Guffa21-Nov-06 21:38 
GeneralRe: custom javascript validation for form Pin
playout21-Nov-06 21:52
playout21-Nov-06 21:52 
AnswerRe: custom javascript validation for form Pin
Anshuman Singh22-Nov-06 0:03
Anshuman Singh22-Nov-06 0:03 
QuestionHow to dynamically add Row in the Datagrid? Pin
nabeelkhan21-Nov-06 20:11
nabeelkhan21-Nov-06 20:11 
AnswerRe: How to dynamically add Row in the Datagrid? Pin
_AK_21-Nov-06 21:11
_AK_21-Nov-06 21:11 
AnswerRe: How to dynamically add Row in the Datagrid? Pin
Anshuman Singh22-Nov-06 0:06
Anshuman Singh22-Nov-06 0:06 
QuestionUploading multiple files (.NET 1.1) Pin
matthias s.21-Nov-06 20:10
matthias s.21-Nov-06 20:10 
AnswerRe: Uploading multiple files (.NET 1.1) Pin
_AK_21-Nov-06 22:06
_AK_21-Nov-06 22:06 
QuestionMouseClick event Pin
Kissy1621-Nov-06 19:28
Kissy1621-Nov-06 19:28 
AnswerRe: MouseClick event Pin
just3ala221-Nov-06 19:58
just3ala221-Nov-06 19:58 
GeneralRe: MouseClick event [modified] Pin
Kissy1621-Nov-06 20:40
Kissy1621-Nov-06 20:40 
GeneralRe: MouseClick event Pin
Kissy1621-Nov-06 23:29
Kissy1621-Nov-06 23:29 
QuestionFileOpen Dialog Box in ASP.NET Pin
R.Palanivel21-Nov-06 19:21
R.Palanivel21-Nov-06 19:21 
QuestionHow to Drag files in ASP.NET Pin
R.Palanivel21-Nov-06 19:10
R.Palanivel21-Nov-06 19:10 
QuestionCheckbox and Confirmation message in ASP.NET? Pin
Vsree21-Nov-06 19:09
Vsree21-Nov-06 19:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.