|
Hi There are many ways to connect to database in ASP.net. Instead of telling you about my logic I would prefer you to use Microsoft Standards and tutorial for this.
Please visit http://asp.net/learn/dataaccess/default.aspx?tabid=63[^]
Regards
Tayyab
Lets work it Out.........!
|
|
|
|
|
Thanks Tayyab,
It's a great site.Got to work on DataAdapters,DataTables ,Datasets etc...It was wonderful to see the outputs..
Thanks a lot...
|
|
|
|
|
Hi. I need advice on a manner;
There are lots of items, that I must count for user hits on them. I use mssql to handle item and hit data. There is need to update hit value on time. There for best performance which way is the best? Or could you give a better advice?
1. make an global array in application state and gather hit values for items in this array. When the array total hit count reaches to a big value (for ex: 10000 hits counted). Make update to all items hit field in the database with;
(1.a) with a loop over hit array
(1.b) write a sql text file and triger mssql to execute this sql command file.
2. update item hit value on every hit
item_table
<br />
id | hit<br />
----------- <br />
1 | 54<br />
2 | 48<br />
3 | 13<br />
4 | 80<br />
.<br />
.<br />
.
thanx
karanba
|
|
|
|
|
I think that the first option is better but u don't need to make it like 1000 because if the server is restarted or any other technical problem occured the values will be resetted ...
Best Regards
3ala2
|
|
|
|
|
Hi friends,
Is there any way to lock ur computer with asp.net????
I mean ...i want the computer of client to be locked if he is idle for some 10 minutes...am not asking about sessions....i want the whole computer should be locked....can any of you great .net programmers solve this problem??....plz give me a way....its very urgent and it will be really a great help for me....plz once again and thanks in advance....
Live Life King Size
Asif
|
|
|
|
|
Hi
I have an asp.net 2.0 project and am experiencing a problem.
In the project, I am trying to make use of Membership.
I have one Role, called "Basic User" and two users - "admin" and "test".
"admin" is a member of the Role but "test" is not.
I have only a few pages in the project at the moment: -
• SecurePage.aspx - The page I want only authenticated users that are members of the Role to use.
• Login.aspx - Login page
• Unauthorized.aspx - Informs user that they cannot view the secure page because of a lack of permissions
SecurePage.aspx just contains a ChangePassword control.
Unauthorized.aspx has some text and a LoginStatus control.
So in the SecurePage.aspx, I have this code to handle this: -
Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If User.Identity.IsAuthenticated = False Then
Server.Transfer("login.aspx")
End If
If Roles.IsUserInRole("Basic User") = False Then
Server.Transfer("unauthorized.aspx")
End If
End Sub
If I go to the SecurePage and am not authenticated, it transfers me to login.aspx.
If I then login with the user "admin", which is in the Role "Basic User", it works ok.
If I first login with "test", which is NOT in the Role, then I am transfered to the "unauthorized.aspx" page.
However, if I click "Logout" on the LoginStatus control on the "unauthorized" page it refreshes and changes to display "Login".
So, if I then click "Login", I am taken back to the login page. The URL in the address bar at this point is: -
http://localhost:1489/Lesson09/login.aspx?ReturnUrl=%2funauthorized.aspx
If I then login with using "admin" - which is a member of the Role - this is where I get a problem.
Instead of being taken to the SecurePage.aspx as expected, I get taken back to the "unauthorized.aspx" page.
This is obviously wrong.
Now, I know that this should work but does anybody know why it is not working?
Is there some settings or something I need to change on my PC? Am I missing a step or not doing something?
I've checked the obvious things - like that the user was actually in the Role etc.
However, I just cannot get this to work.
I am new to ASP.Net and so I don't really know where to start to look for what the problem is?
I have gone through re-doing the project twice now and I still get the same problem.
For info, I am using: -
- Visual Studio .Net 2005 (Professional) (up to date)
- Latest .Net installed
- Windows XP Pro
- Internet Explorer 6 (version 6.0.2900.2180.xpsp_sp2_gdr.050301-1519) SP2
I would very much appreciate any help or advice on this problem.
Thanks in advance.
Kind regards
Darren Brook
email: darrenbrook@btconnect.com
|
|
|
|
|
how can i check if a user supplied date is before the current date?
if this occur, i want to show a message about the error.
i`ve tried with a custom validator and made the test within the server validate event handler of the control. but it didn`t work.
the code is shown below:
<br />
private void cvDtInAt_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)<br />
{<br />
if(DateTime.Parse(txtDataInicio.Text) < DateTime.Now)<br />
args.IsValid = false;<br />
}<br />
also, i`m showing a error summary with the errors occured (as a textbox).
i`m using VS2003 and ASP.NET 1.1
thanks in advance... (:
|
|
|
|
|
I'm guessing that you are already validating that the text can be converted to a DateTime value.
You also might want to DateTime.Today
Is the validation firing?
|
|
|
|
|
yes... it`s firing...
i have already validating if the text can be converted to a DateTime, but using another validator, not this one.
the question is... even if i set de argument`s IsValid property... it still doesn`t show the error in the error summary...
have you got it now?
|
|
|
|
|
are you validating the controls on server side or client side?
Pankaj Gupta
(Take it easy)
|
|
|
|
|
besides "onclick", what other built in attributes can I add to my grid template.
I need to be able to trap all cell change or leave cells at real time.
|
|
|
|
|
onfocus
onblur
onmouseover
onmouseout
Hope this would help
Best Regards
3ala2
|
|
|
|
|
Hi Developers
It has been long time since I was searching for some effecient way to use HTML Reset Button Functionality in an ASP.net Form which runat Server.
Right now i use to Redirect to Same Page when some one click on Reset Button. But it cause a PostBack.
Now I need a generic Javascript Code which can Reset All the Form Fields, when Reset Button is clicked(Obviously it will not cause PostBack)
Thanks in Advance
Lets work it Out.........!
|
|
|
|
|
I didn't write this, but have used it in the past:
Reset button:
Javascript function:
//****************************************************
// ResetValidators(validationSummaryId, validationControlsPrefix)
// Purpose: Resets ASP.NET validation control text display
// AND validation summary control display to empty.
// Inputs: validationSummaryID - string - id of ValidationSummary
// control
// validationControlsPrefix - string - a prefix to use
// to identify validation controls when looping through all
// span Ids. (Validation controls are represented by spans).
// Outputs: none
//****************************************************
function ResetValidators(validationSummaryId, validationControlsPrefix)
{
var spans;
var divValSummary;
if (document.all) {
spans = document.all.tags('span');
divValSummary = document.all(validationSummaryId);
}
else if (document.getElementsByTagName) {
spans = document.getElementsByTagName('span');
divValSummary = document.getElementsById(validationSummaryId);
}
if (spans) {
for (var i = 0; i < spans.length; i++) {
var prefixLength = "" + validationControlsPrefix.length;
var currID = "" + spans[i].id
if ((currID != '') && (prefixLength != '')) {
if (currID.substring(0,prefixLength) == validationControlsPrefix) {
//note - set visibility to hidden, not display=none.
// otherwise validator text will never show up again after reset.
spans[i].style.visibility='hidden';
}
}
}
}
if (divValSummary) {
// note set display=none, NOT visibility=hidden. Exact opposite of
// spans above!! Otherwise, validation summary is hidden permanently.
divValSummary.style.display='none';
}
}
|
|
|
|
|
Thanks a lot dear for ur Help. but my problem is still not solved. The code you given is used to reset the Validation Summary, not the whole form fields along with validators. Hope you understand what i am talking about.
Lets work it Out.........!
|
|
|
|
|
Are you talking about something as simple as:
|
|
|
|
|
Yeah something like this. But Please remember that Page should not Refresh.
Or there might be a loop in javascript which iterates for the whole form elements and reset them
Lets work it Out.........!
|
|
|
|
|
How about
function clearForm()
{
document.<your form="" name="">.reset();
}
|
|
|
|
|
I know you will be getting bore from this thread but I have tried "document.form1.reset()", It Reset Form Fields but it does not Reset the Validators Text against each field. Further more im facing some problems when i use it in FireFox.
Lets work it Out.........!
|
|
|
|
|
You can try something like the following. If it doesn't work completely, you can look at the page source, and locate the validators and find what tag they are being shown in, then add them to this script.
Hope this helps:
<!-- Hide Me
function rezForm(){
forma = window.document.forms[0];
if(forma){
for(b=0; b<forma.length; b++){
var myObj = forma[b];
if(myObj.type == "text" || myObj.type == "textarea" || myObj.type == "file" || myObj.type == "password"){
myObj.value = "";
}
else if (myObj.type.toString().charAt(0) == "s" && myObj.selectedIndex != 0){
myObj.selectedIndex = 0;
}
else if (myObj.type == "checkbox" || myObj.type == "radio" ){
myObj.checked = false;
}
}
for(d=0; d<forma.length; c++){
var daObj = forma[d];
if(daObj.type == "text" || daObj.type == "textarea" || daObj.type == "file"){
daObj.focus();
break;
}
else if (daObj.type.toString().charAt(0) == "s"){
daObj.focus();
break;
}
}
}
}
|
|
|
|
|
hi all ,
Is it possible to use fck editor with asp.net. if yes please send a small demo project used this editor.
mail: srinandan@infoface.com
thanks in advance.
regard,
srinandan
|
|
|
|
|
What is FCK Editor?
Best Regards
3ala2
|
|
|
|
|
|
even though I'm not familiar with the FCK Editor, you can use anything to edit the files (even notepad) if you like.
|
|
|
|
|
what do you think the fck editor is ??
its a tool for formation the text without writing html code.
then what the notbad have to do the web !!!!!!!!!!
Tamimi - Code
|
|
|
|