|
Hi BigMish2,
You need to validate the page before you can tell if it's valid:
Page.Validate()
If Page.IsValid Then
Label.Text = "OK"
Else
Label.Text = "Bad"
End If
I hope this helps.
Ryan
|
|
|
|
|
Thanks Ryan but unfortunately that did not work.
Update: interestingly I get the same behavior as with the code I posted before with the following source code (meaning that Label only displays “OK” if I put text in the text box even when I comment out the conditional!):
Partial Class pageIsValidTest
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'If Page.IsValid Then
Label.Text = "OK"
'Else
'Label.Text = "Bad"
'End If
End Sub
End Class
What is going on?!
|
|
|
|
|
I'm not sure why it wouldn't work after you'd added the Page.Validate()line, does it give an error?
You've commented out the condition the condition, but you haven't commented out Label.Text = "OK" so every time you click the button it will set the labels text to OK regardless of what you do on the page.
|
|
|
|
|
No no error, it just dosn't display "Bad" if I leave the field blank.
I wasn't clear: it only says "OK" if there is text in the feild!
|
|
|
|
|
Hi there,
What you are doing is a server validation using the Validators set on the page, and Page.IsValid property returns a value according to wether a certain Validation Group is valid or not OR all validation controls are valid or not on the page.
In other words checking its value immediatley will be with no value for you, you have to call Page.Validate(validationGroupName) first in order for this value to return the desired and good value of it.
You can call Page.Validate() to validate all validators on the page, or call Page.Validate(validationGroupName) if you have a group, you can set a group of validation on the controls using the ValidationGroup property if you wanted.
Hope that helps.
Sincerely Samer Abu Rabie
Imagination is more important than knowledge !
|
|
|
|
|
Hey All,
I have create some sample code for send sms from the website, have look at the article posted in Code Project.
http://www.codeproject.com/KB/aspnet/SendSMS_ASPDOTNET20.aspx
Regards,
Smart Boy
Mumbai,
(INDIA)
|
|
|
|
|
when i try to install a web setup project on windows vista with iis7
it gives me an error .
'Instalation intrupted' plz some one help me i am stuck with this problem.
|
|
|
|
|
Installation interrupted message is too generic. Is there any specific error messages? Have you checked in the event viewer?
|
|
|
|
|
Check if you got the IIS6 metadata compatibility components installed on you pc.
|
|
|
|
|
I take a mistake like belleow message with runtime ;
"A control with ID 'lnk1' could not be found for the trigger in UpdatePanel 'UpdatePanel2'.."
lnk1 is my LinkButton's ID thats in the Ajax Accordion Menu content ..
and the part of code :
-----------
<Triggers>
<asp:AsyncPostBackTrigger ControlID="lnk1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
-----------
And Please Help me .. Thank u so much for each answers..!
|
|
|
|
|
Can u post complete ajax update panel code.
Also check for the ID for Case sensitive.
Regards,
Smart Boy
Mumbai,
(INDIA)
|
|
|
|
|
There isn't problem ID's about case sensitive..
and the code below :
<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" HorizontalAlign="Center" AllowPaging="True" AllowSorting="True">
<FooterStyle BackColor="LightGray" Font-Bold="True" ForeColor="White" BorderStyle="Solid" BorderWidth="2px" Font-Size="Small" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" Font-Size="Small" />
<PagerStyle BackColor="LightGray" ForeColor="MediumBlue" HorizontalAlign="Justify" BorderStyle="Solid" BorderWidth="2px" Font-Size="X-Small" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="LightGray" Font-Bold="True" ForeColor="MediumBlue" BorderColor="Black" BorderStyle="Solid" BorderWidth="2px" Font-Names="Verdana" Font-Size="X-Small" Font-Strikeout="False" Font-Underline="True" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>
<asp:ImageField DataImageUrlField="MARKA_ADI" DataImageUrlFormatString="images/{0}.jpg"
HeaderText="GÖRÜNÜM">
</asp:ImageField>
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="lnk2" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
|
|
|
|
|
In first post u have said that ur button name was "lnk1" and now in ur this reply with the code ur button name is "lnk2"
Regards,
Smart Boy
Mumbai,
(INDIA)
|
|
|
|
|
The name lnk1 or lnk2 is not important,
I have already a few LinkButton instance, in the Content of Accordion Menu..
Thats the important point, the update panel can not find whatever linkbutton, that i write in the trigger..
Thanks..
|
|
|
|
|
is this link button is in menu?
Regards,
Smart Boy
Mumbai,
(INDIA)
|
|
|
|
|
yep !
like this :
<Content>
<table style="border-color:Black" border="0" cellpadding="0" cellspacing="0" width="129" >
<tr>
<td class="accordionPaneContent">
<p style="text-align:center">
<asp:LinkButton Font-Underline="false" CssClass="accordionPaneLink" ID="lnk1" onclick="lnk1_Click" Text="1" runat="server">HewlettPackard</asp:LinkButton>
</p>
</td>
</tr>
|
|
|
|
|
In event name of ur update panel u have written "Click" as event but in ur linkbutton control onclick event value is "lnk1_Click".
If u r writing ur code in ASP.Net then Handler in the event like
Protected Sub lnk1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnk1.Click
And remove the event name in the Code onclick="lnk1_Click" from ur html and try then.
Best of Luck.
Regards,
Smart Boy
Mumbai,
(INDIA)
|
|
|
|
|
Hi i am looking into implementing the ajax toolkit password strength control and was wondering if it is possible to use this control to prevent the user from submitting the form. I have got the control working so that it informs the user of the strength of their password however i am able to submit the form even if the password requirements are not met.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
|
plz send me the almost good ebook for vs 2008 connectivity using c# language.......
to create most good connectivity in good project
|
|
|
|
|
I currently writing an E-book and its time consuming and it take a lot of my time, previously someone started a thread, and he wanted free e-book download sites. I give him the link and never realized that downloading e-book books from the free sites or dirty sites it’s illegal, Colin warned me about and today am the one who is writing e-books, we spend sleepless night writing and you want to steal it from us. If you want learn Programming buy a Book don’t steal it
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
THANX FOR UR HELP........
|
|
|
|
|
Hi,
my code
aspnet_User user = c.aspnet_Users.First(u => u.UserName == userName);
user.UserName = e.NewValues["UserName"].ToString();
user.LoweredUserName = user.UserName.ToLower();
c.SubmitChanges();
after submit changes my aspnet_user table have 2 rows. one is with old username and another one is with new .. hmm.gif i only want to update the row
|
|
|
|
|
Have you got a primary key on the table?
Andreas Johansson
IT Professional at Office IT Partner i Norrbotten Sweden
What we don't know. We learn. What you don't know. We teach
|
|
|
|
|
Hi,
When i run amy web app in asp.net2.0 with sqlserver2000 , I am getting the Err;
"WebDev.WebServer.exe has encountered a problem and needs to close. We are sorry for the inconvenience."
What could be the problem .
Plz help.
|
|
|
|