|
In a C# 2010 web application, I have avoided using javascript and jquery. I have been totally relying on server side validation since only a few users have access to those web pages. Now I will be adding web form pages where a large volume of users will have access to those web pages.
Thus can you tell me and/or point me to references that are good examples of how to start using javascript and/or jquery in web form 2010 applications?
|
|
|
|
|
Ironic Response[^]
BTW: jQuery [^] is JavaScript so you should just be able to use it.
"jQuery is a fast and concise JavaScript Library" form the front page.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
mark merrens wrote: Ironic Response
Wow, word for word and a whole different name as poster...
Am I the only one who suspects the OP is also dcof[^]?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I have a couple of questions about using a range validator on a C#.net 2010 web application. I am validating dates that must be between 01/01/2000 and 12/31/2020. My range validation works, however a couple of issues have shown up which includes the following: 1. a user can enter a date like 07.15.2012 and the date is accepted with no error. Why do this occur? My company wants to force the user to enter a date like 07/15/2012 and not accept a date like 07.15.2012. Can you tell me how to force this edit? Do I need to use regular expressions?
2. When the user enters a wrong date, the error message shows up for like a couple of seconds and goes away. This occurs before a user hits the 'enter' button to proceed to the next web page. Can you tell me how to make this error message display longer and/or only display when the user clicks the next button?
|
|
|
|
|
dcof wrote: My range validation works
See below comment
dcof wrote: a user can enter a date like 07.15.2012 and the date is accepted with no error. Why do this occur?
Your range validator doesn't work
dcof wrote: Can you tell me how to force this edit?
You can force the edit, by replacing the . with a / using Javascript, or just take the value and post it, then alter the value to the flavor that you prefer.
no code samples because you have to decide what your going to implement first.
[EDIT]
I didn't test this, but I think I got it right for Javascript
var startDate = "7.1.2012";
startDate.replace(/\./g, "/");
modified 26-Jul-12 19:03pm.
|
|
|
|
|
I have a ajax calendar control , i want that calendar render with only past Sundays else date should be disable
|
|
|
|
|
Hello,
I have a question and I thank everyone for helping me in advance.
I am using Visual Studio 2010, ASP.NET and C#.
I have a table in SQL server DB.
Server page (news.aspx.cs) is collecting all the data from the table (
select * from news ).
Using
container.Controls.Add(new LiteralControl(news.ToString()));
I am sending the query results to front page (news.aspx).
Now, I have that data put in separate DIV tags, one news in one DIV tag, and my idea was to hover over one div and to expand that same DIV with one small picture and more text (small picture url and the text are all stored in the same SQL table news.)
When I hover over a div, it expands, but it shows only the picture and the text that is stored in the first row ,n the SQL table.
Question:
How do I make it, that when I hover over one DIV and get the details belonging to that row, not the first row??
Thank youuuu
|
|
|
|
|
You do it like this
News & Updates
<asp:repeater id="rpt_News" runat="server">
<itemtemplate>
- <%#Eval("YOURnewscolumname")%>
|
|
|
|
|
News & Updates
<asp:repeater id="rpt_News" runat="server">
<itemtemplate>
- <%#Eval("YOURnewscolumname")%>
|
|
|
|
|
I want to use update progress bar in master page. And these master page is inherited by other aspx pages. In the aspx page when any button click is occurred while loading a page this update progress bar should appear. And after loading it should make invisible. So please help me in this question.....
|
|
|
|
|
|
HI Vani,
Yes i want to use a global progress bar. So that i can use it in entire of my application.
And the above solution you gave is not working. When i give any request it is not even displaying. So Plz help me.
|
|
|
|
|
Hello,
I was wondering if anyone has any input or guidance in why some PS cmdlets won't work on remote computers when executing a script file from an ASP.NET site.
These scripts work from PS console on server1 to the Spooler service on server2 and also work if the script is run via ASP.NET on itself.
Invoke-Command -ComputerName "Server2" -scriptblock {Stop-Service -Name "Spooler" -Force}
However, through the ASP.NET site it doesn't work. There are no errors or any output that I can see.
I was able to get around this by using the -Credential switch. But this requires me to hard code the credentials which I do not want to do.
$username = Get-Content "C:\inetpub\wwwroot\Scripts\_un.txt"
$password = Get-Content "C:\inetpub\wwwroot\Scripts\_pw.txt"
$password = $password | ConvertTo-SecureString -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
Invoke-Command -ComputerName "Server2" -Credential $cred -scriptblock {gwmi win32_service -filter "Name='Spooler'" | Stop-Service -Force}
Invoke-Command -ComputerName "Server2" -Credential $cred -scriptblock {Stop-Service -Name "Spooler" -Force}
This is how I'm executing the PS scripts in ASP.NET C#.
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
var shell = PowerShell.Create();
string filePath = Server.MapPath("PS/StopSpooler.ps1");
StreamReader reader = File.OpenText(filePath);
string powerShellCode = reader.ReadToEnd();
reader.Close();
shell.Commands.AddScript(powerShellCode);
var results = shell.Invoke();
My site is very basic and is using Windows authentication. It is also being launched while logged in as a domain administrator.
Thanks!
modified 26-Jul-12 3:07am.
|
|
|
|
|
In a C# 2010 web application, I want to add a server side regular expression value that can edit a date in the following format:
mm/dd/yyyy where mm is month, dd is day, and yyyy is year. I want the user to be required to enter the backslashes. From what I have seen on the internet, the following 2 examples would have the code that works:
1. (0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d)
2 ^(0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/](19|20)\d\d$
Based upon the above, can you tell me the following:
1. Which method would work and why?
2. If neither method would work what would you recommend that would work?
3. From the examples above, what does [- /.] stand for? I know the dot is only one character and the / is the character that is being looked for? However what does the dash followed by a space mean? Is this the same meaning as [/]?
4. In the above examples you can see 1[012]. Does that mean that the first digit must 1 and the second digit can be either 0 or 1 or 2?
5. When looking at the regular expressions, is there a way to tell what the pattern being matched against means? Basically is there a way to tell what the regular expression means by using a tool like the .net debugger?
|
|
|
|
|
dcof wrote: I want the user to be required to enter the backslashes. Firstly those are not backslashes and secondly why do you want such an unfriendly web page? Use a Calendar control[^] that does all the work for you.
One of these days I'm going to think of a really clever signature.
modified 26-Jul-12 6:21am.
|
|
|
|
|
The requirements from the user explicitly states that they can either use a calendar control or type in the date. So I am using a calendar control already. However they want to be able to enter the date manuallhy if they chose to.
Is there a way I can make them use a calendar control only?
|
|
|
|
|
Take a look at this article[^] for some suggestions.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi,
I have web page that has useful information on it but I don't want any user copy this information or add my logo if user copy this.please help me
|
|
|
|
|
You can't. You can make it complicated, but you cannot fully prevent a user from copying the contents.
|
|
|
|
|
So, how can I complicate it ? can I Add logo of my site in a back ground or some thing like this when they copy this data the logo appear on it?
|
|
|
|
|
It's impossible to prevent someone from taking a screenshot So if you embed your image as base64, split up the base64-string in variables and spread it around in a bunch of js-files, it's still easy to copy your logo.
--------------------
When Chuck Norris' dreams come true, your worst nightmares begin.
|
|
|
|
|
That's a good idea thanks but can you give me an example of it , write some code please
|
|
|
|
|
code to base64 encode and split it?
You can do it. I'll give you a few tips:
Online tool for converting images to base64 embedded image: http://webcodertools.com/imagetobase64converter/[^]
This will give you an img-tag ready to use.
Example (using jQuery):
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf89hAAAAB3RJTUUH2AQPB0tAAAAARnQU1" />
I removed most of the string for it to be easier to read. They are usually very long
Then you take the base64 value "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf89hAAAAB3RJTUUH2AQPB0tAAAAARnQU1", put it in a javascript variable (or multiple) like this:
var part1 = 'iVBORw0KGgoAAAANSUhEUgAAABAAAAA';
var part2 = 'QCAYAAAAf89hAAAA';
var part3 = 'B3RJTUUH2AQPB0';
var part4 = 'tAAAAARnQU1';
Remove the src-attribute value from your img-tag and give it an id-attribute
<img src="" id="myImg"/>
$(document).ready(function(){
var base64src = 'data:image/png;base64,' + part1 + part2 + part3 +part4;
$('#myImg').attr('src', base64src);
});
This will NOT prevent a user from copying your image! It's (as I said) easy to do a screenshot...
--------------------
When Chuck Norris' dreams come true, your worst nightmares begin.
|
|
|
|
|
I did it but it doesn't different between your code and add image as background , I want when user copy my text in a web page and paste it on word both text and logo paste
|
|
|
|
|
Isn't your question about preventing this?
--------------------
When Chuck Norris' dreams come true, your worst nightmares begin.
|
|
|
|