Hi all, I checked the validation for my form by using DataAnnotations. [Required(ErrorMessage="User Name is Required")] [StringLength(12,MinimumLength=6,ErrorMessage="User Name must be in between 6 to 12 Characters")] public string UserName { get { return _UserName; } set { Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName="UserName"}); _UserName = value; } }
The error is always throwed at [Validator.ValidateProperty] and applicaton is stopped!! why on my friend's PC is not and the error message is displayed near the textbox normally. The strange is any source code that i got from internet or from my friend's PC is run normally with DataAnotation. But when i clean project and build it again, the application always throw error ( like : value is required ... ) at Validator.ValidateProperty and application is exited ( or stop running ) How could i solve it ?
ctlqt12
Posts
-
Validator.ValidateProperty always throw error and application is exited -
cross-domain in WCFHi all, I have two projects in same solution : 1 WCF project and 1 silverlight project. WCF project start at port : 54432 Silverlight project start at port : 55647 i deploy WCF project on IIS and copy ClientAccessPolicy.xml and CrossDomain.xml into wwwroot folder. From SL project, i add reference service to WCF on IIS. It's run. But from SL project, i add reference service to WCF project in same solution and run. I found the error about cross-domain. I already added ClientAccessPolicy.xml and CrossDomain.xml into the root of WCF project. The same error is displayed. Could you please guide me to solve it? Any helps will be welcomed
-
get control name in a canvasI solve it. Thank you for your support !
-
get control name in a canvasHi all, I have a canvas ( naming cn ) with MouseButtonDown event, i also have three textblocks in it. When i press a textblock in canvas, the event is raised with the sender is canvas ( of course ). How could i get the name of clicked-textblock ?
-
why wcf use basicHttpBinding instead of wsHttpBindingHi all, I found several links for this but no definitive answer. Could you please tell me the reason
-
call many method in CustomValidationHi all, I have a quantity attribute in a dataform and want to validate it.I also have two methods for validate it. Their name are : ValidateUnit and ValidateQuantity. But unfortunally i could only call one method for validate it by following below code :
[CustomValidation(typeof(UnitValidation), "ValidateUnit")]
public string Unit;
.......How could i call two methods for validating Unit ?
-
silverlight, wcf and nhibernateHi all, I'm learning combine wcf and nhibernate in silverlight, i follow instruction of this link http://www.squarewidget.com/post/2010/02/NHibernate-101-Silverlight-4-with-NHibernate-2n.aspx for creating sample But i have an error about [Instrument is not mapping], i changed the hbm.xml file and run again. The error message is not changed. It seems the Instrument.hbm.xml is not read. Could you please help me to solve this problem? Or if you have any source code relate to silverlight, wcf and nhibernate, please give me. Any suggestion will be welcomed Regards, Tuan Lam
-
Export data from gridview to csv fileHope this will help you :
private void OnExportGridToCSV(object sender, System.EventArgs e) { // Create the CSV file to which grid data will be exported. StreamWriter sw = new StreamWriter(Server.MapPath("~/GridData.txt"), false); // First we will write the headers. DataTable dt = m_dsProducts.Tables[0]; int iColCount = dt.Columns.Count; for(int i = 0; i < iColCount; i++) { sw.Write(dt.Columns[i]); if (i < iColCount - 1) { sw.Write(","); } } sw.Write(sw.NewLine); // Now write all the rows. foreach (DataRow dr in dt.Rows) { for (int i = 0; i < iColCount; i++) { if (!Convert.IsDBNull(dr[i])) { sw.Write(dr[i].ToString()); } if ( i < iColCount - 1) { sw.Write(","); } } sw.Write(sw.NewLine); } sw.Close(); }
-
auto email generationHi chandra_77, For sending mail in ASP.Net 2.0 ( C# ), you can use the following code
using System.Web.Mail; MailMessage mail = new MailMessage(); mail.To = "mail.From = "sender's mail"; mail.Subject = ""; mail.Body = ""; SmtpMail.SmtpServer = ""; SmtpMail.Send(mail);
Hoping this will help you ^^ -
customize the datatableHi Basheer, If you want to customize datatable, you can get table by following code :
ds.Tables[0] //ds is dataset
When you get table in dataset, you can do anything with that table Hoping this will help you ^^ -
Each row of gridview is a treeview [modified]Hi all, I have a array of treeview, and i want to display that array on GridView that each row of GridView is a treeview. Ex :
+ John Details
- Age : 12
- Sex : Male
- Peter Details
- Age : 14
- Sex : Male
- Jes Details
- Age : 15
- Sex : Female
........
Like display QA in this website. How could i do that? -- modified at 11:36 Tuesday 18th September, 2007
-
Create and add event for linkbuttonHi all, I have a form with a button and a textbox. When i click button, linkbutton will be create on form. When i click linkbutton, "Hello" will be filled into textbox.
protected void Button1_Click(object sender, EventArgs e) { LinkButton lbtn = new LinkButton(); lbtn.ID = "MyLinkButton"; lbtn.Text = "Welcome"; lbtn.Command += new CommandEventHandler(lbtn_Command); form.Controls.Add(lbtn); } protected void lbtn_Command(object sender, CommandEventArgs e) { txt.Text = "Hello"; }
But when i click LinkButton, Command event is not raised. What can i do to raise Command event of LinkButton?
-
GridView, set parameters in HyperLinkField's NavigateUrlHi all, I have a GridView (grv) that contain a HyperLinkField ( "MyLink" ). I have a DataTable (dt) that contain data for GridView. ( I don't use SqlDataSource ) When i click "MyLink", "MyLink"'s NavigateUrl will be Default.aspx?id=param1&idU=param2. How could i do that?
-
Gridview paging rowHi all, Could i change the row of GridView that is used for displaying paging like following :
| | 1 2 3 4 5 6 7 | 20 |
| ID | NAME |
| 01 | Kate |
| 02 | Jessica |
| 03 | Tom |
| 04 | Han |It means in paging row, could i add a button or something else?
-
Problem connect database via IIS 5.1Hi all, I have a problem when deploy a website on IIS. When i deploy and run website through VS2005, i got no problem but when i run that website on IIS, i have error that website can't connect to database. Please help me to solve that error
-
Framework for developing ASP.NETHi all, Spring.Net is not only too configurable but also it doesn't really have the structure of files for validation, database, .... Why i need something that sits on top of that? Because when i use ASP.Net framework, I don't have good structure of files and interacting between files Example : + Validation + Transaction + Database ...... So i need a framework that already has structure of files and when i write a file, i know where i put it.
-
Framework for developing ASP.NETHi all, I want to make a framework for developing ASP.NET and i see Spring.Net. But i think Spring.Net is not good. Because it has too much configs. If you know a framework that can be used for developing ASP.NET, please let me know. Thanks
-
If we have ASP.NET AJAX, why should we learn Ajax?Hi all, I'm newbie of ASP.NET, and i want to use Ajax in ASP.NET. But i realize that Ajax is supported in ASP.NET by ASP.NET AJAX. And if i want to use Ajax, i just put that control to UpdatePanel. And i think the security of ASP.NET AJAX is better than i write a file with tranditional Ajax Therefore, i don't know why should we learn Ajax when i have ASP.NET AJAX. Please let me know why should i learn Ajax?
-
count of rows in datarowHello, you can try this
If dr Is Nothing Then ' dr is DataRow MessageBox.Show("Row has no value") Else MessageBox.Show("Row has value") End If
-
count of rows in datarowHello, You can try this :
Dim dr() As DataRow dr = ds.Tables(0).Select("id > 'o'") 'ds is a DataSet If (dr.GetLenght(0) = 0) then 'Has no row Else 'Has row End if