|
|
I have a textBox Where I type date. I want to validate it. Im using customValidate controls. I have this function in my code behind page
void DatesValidate(object source, ServerValidateEventArgs e)
{
if (Convert.ToDateTime(e.Value) <= DateTime.Now)
{
e.IsValid = false;
this.lblAddUsers.Text = "The Proxy is already expired";
}
}
<asp:customvalidator id="cvEndDate" runat="server" onservervalidate="DatesValidate"
="" controltovalidate="txtTo" errormessage="error" display="Dynamic">
It is not working it is giving the follo2ing error
'Proxy.DatesValidate(object, System.Web.UI.WebControls.ServerValidateEventArgs)' is inaccessible due to its protection level
seema
|
|
|
|
|
I have a textBox Where I type date. I want to validate it. Im using customValidate controls. I have this function in my code behind page
void DatesValidate(object source, ServerValidateEventArgs e)
{
if (Convert.ToDateTime(e.Value) <= DateTime.Now)
{
e.IsValid = false;
this.lblAddUsers.Text = "The Proxy is already expired";
}
}
<asp:customvalidator id="cvEndDate" runat="server" onservervalidate="DatesValidate"
="" controltovalidate="txtTo" errormessage="error" display="Dynamic">
It is not working it is giving the follo2ing error
'Proxy.DatesValidate(object, System.Web.UI.WebControls.ServerValidateEventArgs)' is inaccessible due to its protection level
seema
|
|
|
|
|
Use the protected access modifier in front of the method declaration. By default, methods are private when specified without an access modifier.
Jon Sagara
Once again, the conservative sandwich-heavy portfolio pays off for the hungry investor! *slurp* Oh, I'm ruined!
-- Dr. Zoidberg
.NET Blog | Personal Blog | Articles
|
|
|
|
|
Hi,
I have a asp pase. I have one text box, txtName, txtStartDate, txtEndDate. and a button Submit.I have a grid view hand it has edit, delete and cancel buttons. I want to validate my page.
I have three RequiredValidation controls for three text boxes. I want that error message should only appear when I click on button. But when I click on some where in grid view or when I select any row in grid view it should not show error message.
Thanks.
seema
|
|
|
|
|
You will need to toggle the Page_ValidationActive javascript variable similar to what I just outlined here[^].
Only in your case, you probably want to set it to false in the body OnLoad event, and then set it to true in the button's onclick event.
|
|
|
|
|
hi,
u set ValidationGroup Property of RequiredValidation controls and also for that button on which you want the error message.ValidationGroup should be same for all control
Jintal Patel
|
|
|
|
|
Hey guys, I'm trying to make a contact us page for my website and I was reading an article about
that matter http://www.codeproject.com/useritems/EmailApplication.asp
I did exactly as was explained in the article I've added a valid pop3 and SMTP address and
the account which I'm sendin the mail to is also created in my website ! but when I click send I
get this error !
string Name = TextBox1.Text;<br />
string Address = TextBox2.Text;<br />
string Message = TextBox3.Text;<br />
<br />
SmtpClient SC = new SmtpClient();<br />
MailMessage Msg = new MailMessage();<br />
<br />
try<br />
{<br />
MailAddress FromAddress = new MailAddress(Address, Name);<br />
SC.Host = "mail.mla.ir";<br />
SC.Port = 25;<br />
Msg.From = FromAddress;<br />
Msg.To.Add("keivan@mla.ir");<br />
Msg.Subject = "FeedBack";<br />
Msg.Body = Message;<br />
SC.Send(Msg);<br />
}<br />
catch (Exception ex)<br />
{<br />
Label4.Text = ex.ToString();<br />
}
System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable.
The server response was: Verification failed
for at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message) at ContactMe.Button1_Click(Object sender, EventArgs e)
in (My file)
please help me out !
Thaqnx
Mr.
K
|
|
|
|
|
I don't know if this would help.
I read somewhere that the FROM field can not be a variable and must be set to an existing email address in the server.
Try using your email address in the from (the one registered in the server you use to send the email). Also find out if your server needs to validate user and password.
If it does you might need to supply them.
And if this works and you need to register the sender's email just add it to the sender message.
Hugo
Hugies.....
|
|
|
|
|
Hey there,
i have a gridview inside my repeater.
Why cant i directly access it from my code?
what do i need to do, and what have i overlooked?
Christian
cbm.dk
|
|
|
|
|
try this:
<br />
GridView gv = (GridView)dataRepeaterId.Items[X].FindControl("gridViewId");<br />
where dataRepeaterId and gridViewId correspond with how you have them labeled in the markup and X is the index of the item you wish to get the gridview out of.
The problem is your gridview is inside another control so you have to pull it out.
|
|
|
|
|
Hi all,
I am using GridView in one ASP.NET, VB.NET application. I want to select data using select command of SqlDataSource but I don't want to do other operations like deleting and updating using SqlDataSource. So I am using RowDeleting() and RowUpdating() event handler of GridView. But When I click on Delete link in GridView it goes to event handler, do delete operation using my custom query and then it gives me error like "Deleting is not supported by data source (SqlDataSource1) unless DeleteCommand is specified". Any way to get rid out of this DeleteCommand?
Thanks in advance,
Priyank
|
|
|
|
|
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
e.Cancel = True
End Sub
I hope it should work.
http://www.tsspltd.com
|
|
|
|
|
Hi,
When manually binding an SqlDataSource, sorting and paging does not work on the GridView. Is there some kind of settings or code to make the sorting and paging work?
SqlDataSource1.SelectCommand() = sSQL
GridView1.DataSource = SqlDataSource1
GridView1.DataBind()
Note that when the SqlDataSource1 and the GridView is bind at design, the sort and paging work fine.
Thank you.
|
|
|
|
|
My problem is that I can't put the html that is rendered by my .aspx file into a pdf file using itextsharp.
the aspx file does not contain any pictures.
BiG RaLpH
|
|
|
|
|
i have a document library (named: Outstandings) which contain word cosuments, i searched a document (named: Balance_343,35725.doc) within this library , i ahve some columns in this library, i want to change the value of column/filed(named: Document Library) , how can i change the value of field? (actually i want to show a library name as link in the clumns in front of document)
This is my code:
SPSite sitecollectiont = SPControl.GetContextSite(Context);
SPWeb sitet = sitecollectiont.OpenWeb();
sitet.AllowUnsafeUpdates = true;
SPListCollection lists = sitet.Lists;
foreach (SPList list in lists)
{
if (list.Title == "Outstandings") //this D. library
{
SPListItemCollection items = list.Items;
foreach (SPListItem item in items)
{
SPFile file = item.File;
string docName = file.Name;
if (docName.Equals("Balance_343,35725.doc"))
{
SPField field = item.Fields.GetField("Document Library"); //this is column name
field.DefaultValue = "1234";
field.Update(true);
return;
}
}
}
but setting its value by defaultValue necver worked.
Please help to set the value as a link to Library.
Thanks
Needo
|
|
|
|
|
hi
i'd like to know how can i only get date part of a variable not the time part
for example i have a variable that its value is "1/1/2000 12:00AM" and i only want "1/1/2000"
thank you
|
|
|
|
|
myDate.ToShortDateString()
|
|
|
|
|
how can i specify certain file formats to be browsed by file upload control?
for example i just like my file upload control to browse JPG and GIF files
thank you
|
|
|
|
|
I tried this but there no way that you can show a specific type of files howerver after browsing you can check the extension and prompt the appropriate message.
Shujaat
|
|
|
|
|
I am using a Gridview which is getting it's data from a Stored procedure. The values passing to the stored procedure are coming from a QueryString.
When I run the GridView configuration the correct data is returned when I test the connection but when I run it, the gridview page just comes back blank and displays nothing.
Anyone any ideas?
macca
|
|
|
|
|
It sounds as though you are missing a call to the DataBind() method of the gridview after settings its DataSource .
|
|
|
|
|
Thanks for the reply Brent but:
How and where can I set this?
macca
|
|
|
|
|
Hmm you must be using the visual interface to to get your data rather than coding your own data access layer. In that case I won't be able to help much ( I prefer to code my own DAL) other than to say it sounds as though your gridview is not bound to the data source correctly.
|
|
|
|
|
Brent, Got this sorted. I coded instead.
Thanks,
macca
|
|
|
|