two asp validations in one [closed] - asp.net

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
how can I check for a regular expression (email) and make sure the field in a form is non-empty at the same time?
if I leave it to regular expression only, it accepts empty strings
if I place two validators, it takes the space for two labels, and sometimes both errors show next to each other, i only want one label for the error
thanks!

Use a RequiredFieldValidator and the RegularExpressionValidator and set Display to Dynamic, then it won't take two spaces.
Dynamic:
Space for the validation message is dynamically added to the page if validation fails.
In general it's a good idea to use two validators because you can provide two meaningful error-messages ("Please enter email" or "... must be a valid email").

Related

Compare two xmls using xquery [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have two xmls, say Sample1.xml and Sample2.xml. Now I need to compare both the xml values (parent nodes, child nodes, attributes and its values) and return the differences between them in xquery. I knew I can use deep-equal function to say if the xmls are identical. But I do not know how to compare and return the xml difference.
Please help.
Thanks,
-N
Depending on the degree of generality we're talking about here, this is a non-trivial problem (PDF). If your question is, "how do I write this algorithm," then it's way too open-ended for StackOverflow (see the FAQ). If, on the other hand, you are asking, "Is there any XQuery library code out there that will do this," then it appears that simply Googling "XML difference XQuery" will lead you straight to the answer. Faster, even, then having someone else do the Googling for you on Stack Overflow.

add new field to the standard aspnet_Membership table [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have added a new field to the standard aspnet_Membership table.
Now that it's added, how do i get or set this field by UserId?
Delete, plese.(5-8-2013)
You should not change default membership table . Instead use profile fields. Following articles will help .
http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx
http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx
I don't recommend to use the profile features due it have a way too dirty to store the data. Only if you need just one or two more fields, it may have sense.
Anyway, you need to attempt to document yourself a little more before ask this kind of questions...

How to keep page view count? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
When I refresh the page, page count does not increase. It is kept in session or any way. For example, in SO, I clicked any qouestion, question view count increase. And I return that question again after look another it is not increase.
What is the logic? And Sorry my poor english. I hope I can explain. I dont know correct tag for this question too.
Thanks.
You may check the IPAddress of the request coming from and check it. If A request already came (page view) from this IP for this page, then do not increase the count, else increase.
If you store it in session it can be hacked by different browsers. Ex: If i open the page in 3 different browsers ,the count will be increased 3 numbers. So do not use Session for that.
You can have a table to do that. Have a QuestionId, IPAddress, DateVisited columns. It is up to you to decide whether the visit should be counted if user visit on a different day from the Same IP for same question . Since you have the data in table, you can do the IF condition as per your wish.

Search box to work like google search [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a sql query that should return results for user text (Like free text search)which can be a single character or word or combination of words.
For example if I have column named "subject" and its value is Very long test, then I want a query that can give result if I put test or t or `e'in the query below
select Subject from [dbo].[Email] where Contains(Subject,'%usertext%')
I tried handling in code behind and then sending it to the query as parameter.
am editing this question because of so many down votes. Please if you dont understand the question simply comment so I can try to ask more clearly. That would be helping me.
You don't need the % character, since the function Contains already implied that.
So :
select Subject from [dbo].[Email] where Contains(Subject,'t')
The % are for LIKE function
select Subject from [dbo].[Email] where Subject LIKE '%t%'

How to rectify the error in asp.net [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I create an one webpage in asp.net all the time i am facing the following pbm how to rectify it..
if(ds.Tables[0].Rows.Count > 0)
Maybe you need to check that ds.Tables[0] exists first
If you are constantly checking on your pages to see if that dataset has a table with rows, I would think you would want to make some helper class to check that your dataset is not null, and that whatever tables have actual rows. Also you might want to think about moving these to typed datasets.

Resources