|
Hi al,
I am using asp login control.If i enter special characters like < ; ! it throws server error. How to over come this. Can we validate the asp login control??
|
|
|
|
|
You can do this by any of these ways:
1. Check the user name and password entered for special characters in the LoggingIn event of the Login control.
2. Place a validator (RegularExpression or Custom as per your need) and set its ControlToValidate property as the user name and the password text box. You can find the ClientID of them through FindControl.
3. Use LayoutTemplate to customize the Login control as per your need.
|
|
|
|
|
In my Visual 2005 ASP.NET project I would like to break up my _Default C# code behind file into multiple .aspx.cs code files. Can I do that? How do I do that?
I would like to declare _Default partial classes in multiple code files.
Normally in a windows app I could just declare the same class as a partial class in multiple files. However, when I try this in ASP.NET I get a conflict error at compile time.
Thanks!
Mark
|
|
|
|
|
I've never seen this done in ASP.NET. Perhaps you can break some functionality into a different class and have your page class carry an instance ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
mjc225 wrote: OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Events WHERE ([EventStartDate]>=StartDateExport) AND EventEndDate>=#12/1/2009#", cn); //This doesn't work.
Of course it doesn't. You're missing something pretty basic. When you put something in quotes, it's a literal. You're passing the word StartDateExport, instead of passing the value of the variable of the same name.
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Events WHERE ([EventStartDate]>= " + StartDateExport + ") AND EventEndDate>=#12/1/2009#", cn);
If you don't understand how to concatenate strings, I'd suggest you should work through a basic C# book before going further.
Depending on where your dates come from, it's possible you will have a massive security hole in your site, due to SQL injection attacks. In any case, for you to put this in your page load is terrible design ( really, it's no design at all ). If you're teaching yourself or doing a class, it's probably fine, but if anyone is paying for this code then they are paying too much.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
public int LoadByCategories(int categoriID)
{
Connection.Open();
try
{
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "exec GetBooksByCategory @ID";
cmd.Connection = Connection;
cmd.Parameters.Add(new SqlParameter("ID", categoriID));
return cmd.ExecuteNonQuery();
}
finally
{
Connection.Close();
}
}
after this Function raises Error
DataBinding: 'System.Int32' does not contain a property with the name 'ID'.
what's the problem?
C# Developer
|
|
|
|
|
West1989 wrote: try
{
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "exec GetBooksByCategory @ID";
cmd.Connection = Connection;
cmd.Parameters.Add(new SqlParameter("ID", categoriID));
return cmd.ExecuteNonQuery();
}
You are doing wrong here. You are trying to execute Stored procedure ?
Look at this
public int LoadByCategories(int categoriID)
{
Connection.Open();
try
{
SqlCommand cmd = new SqlCommand();
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText="GetBooksByCategory";
cmd.Connection = Connection;
cmd.Parameters.Add(new SqlParameter("@ID", categoriID));
return cmd.ExecuteNonQuery();
}
finally
{
Connection.Close();
}
}
Hope this will help you
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
West1989 wrote: cmd.Parameters.Add(new SqlParameter("ID", categoriID));
Change ID to @ID here and try
Cheers!!
Brij
|
|
|
|
|
but there is same error
DataBinding: 'System.Int32' does not contain a property with the name 'ID'.
look
public void LoadByCategories(int categoriID)
{
Connection.Open();
try
{
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "exec GetBooksByCategory @ID";
cmd.Connection = Connection;
cmd.Parameters.Add(new SqlParameter("ID", categoriID));
cmd.ExecuteNonQuery();
}
finally
{
Connection.Close();
}
}
it warks, there is problem with return type, but i can not understand it
C# Developer
|
|
|
|
|
Did you check my code? I didn't see any change in your current code? Please check my first post.
Thanks !!
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Abhijit Jana
Yes, I checked it but as I said there is same error
C# Developer
|
|
|
|
|
Well, the code you posted is different to the code he gave you, so why did you post that ?
What line gives the error ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
West1989 wrote: cmd.Parameters.Add(new SqlParameter("ID", categoriID));
Change with
cmd.Parameters.AddWithValue("@ID", categoriID);
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Hi,
dim strExp as string
strExp = "HRA + iif(Basic > 2000), 3000, 4000)"
am assign value to the string
strExp = "2000 + iif( 3000> 2000), 200,500)"
strExp has to return value, but its return the same string.....
am trying to convert to integeer am getting exception...
how to do this andto get the value of the iif condition
plz answer me if anyone knows..
regards,
kannak......
kannak
|
|
|
|
|
do like
strExp = HRA + CInt(IIF(Basic > 2000,3000,4000))
I think the Quote mark is the culprit..
|
|
|
|
|
Are you making the assumption that an expression is being resolved when you assign a string literal to a variable? Wrong assumption.
You're getting the error because the string literal "2000 + iif..." is no more numeric than the string literal "hello world". In your example, are "Basic" and "HRA" variables?
|
|
|
|
|
environment: vb .net (v2+, no v3 support yet here on production machines)
I need to be able to display an html physcial file as a thumbnail on a web page. I can't put my finger on an easy solution. If I have to convert it to an image (bmp, jpg, etc), I don't want to do it as it adds too much overhead to the process. I would rather just throw a new browser up and display the whole doc instead.
I need to write code that produces as little overhead as possible. I just can't see the path to the end of this without a conversion in the middle. Is there one?
Why: We produce (some) documents via an XML translation to html (via XSLT). The output is written and stored in a physical file location (for later use). The user is allowed to FAX the document where we pull the file from the drive, attach the doc as a file to email and send it along to our fax server as an attachment. That all works great already. But I wanted to display what is going to be faxed on the web page as a thumbnail before sending the doc.
|
|
|
|
|
There's no way without some overhead that I know of.
I would be tempted to use the WinForms WebBrowser control behind-the-scenes for something like this, utilizing its DrawToBitmap method.
|
|
|
|
|
well, there is no easy means to make a thumbnail of an entire page with the exact layout. If you can create a mini version of the same web page, u can load that in an IFrame.
Generally what most of the websites do, is just show a small thumbnail picture of the site and place in the site.
I dont think there is any possible way other than this. If so, I would love to see them.
|
|
|
|
|
Can any one tell me how to do Unit testing in Asp.net MVC Application....i am new to MVC and learning the MVC so dont hav much idea abt that.......i treid to search in google also.....but i dont know the basic thing og unit testing so dont get idea from that......
Thanx in Advance....
|
|
|
|
|
|
Thanx for this video.......its really helpful......
Do u have more video links or articles for that????
|
|
|
|
|
vid nandha wrote: Do u have more video links or articles for that????
ASP.NET MVC Videos
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi,
How to change the image of the clicked image button in a gridview.
Thankyou
|
|
|
|