|
I NEED caching to run my app., hence I cannot remove the caching feature.
I want the contents of the UC to be cached for 2 minutes and then afterwards, get the updated contents and display on container page and then cached again...
Thanks
|
|
|
|
|
Hi,
If its neccessary to user Caching in ur usercontrol then you should choose some other approach to implement the functionality that u want to implement by using reference of UC in the page codebehind.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Thanks.
I'll see what I can come up with.
|
|
|
|
|
Add the following element to the OutputCache directive for your usercontrol
VaryByControl= name of the property by which u want to cache your control
|
|
|
|
|
Hello to Everyone,
How can we use multiline and New line character in asp.net(vb)
Thank You.
|
|
|
|
|
Well hemant im unsure but I think "vbCrLf" can be used for newline.
|
|
|
|
|
Hi, I finally got my code to send a user's username and password to the database. However, it did not check to see if the username has already been taken and did not prompt the user for a new username like it was designed to. I will put in code to prevent sql injection and use other validations later. As for now I just want it to work. Please help point out the cause of this problem. Thank you in advance for your help
Private Sub lblRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblRegister.Click
Dim myConnection As OdbcConnection
Dim myCommand As OdbcCommand
Dim strInsert As String
Dim strSQL As String
strSQL = String.Empty
myConnection = New OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=myServer;Database=myDB;User=myUser; Password=myPW;Option=3;")
strSQL = String.Format("SELECT UserName FROM myTable WHERE (UserName='{0}');", txtUserName.Text)
myCommand = New OdbcCommand(strSQL, myConnection)
myCommand.CommandType = CommandType.Text
myConnection.Open()
Dim result As Integer = myCommand.ExecuteNonQuery()
If result > 0 Then
lblMessage.Text = "That user name is already taken!"
lblMessage.Text &= " Please choose another user name."
Else
strInsert = "INSERT into myTable (FirstName,LastName,Password,UserName)values (?,?,?,?)"
Dim myCommand1 As OdbcCommand = New OdbcCommand(strInsert, myConnection)
myCommand1.CommandType = CommandType.Text
myCommand1.Parameters.Add("@FirstName", txtFirst.Text)
myCommand1.Parameters.Add("@LastName", txtLast.Text)
myCommand1.Parameters.Add("@Password", txtPassword.Text)
myCommand1.Parameters.Add("@UserName", txtUserName.Text)
Dim result1 As Integer = myCommand1.ExecuteNonQuery()
myConnection.Close()
End If
txtFirst.Text = ""
txtLast.Text = ""
txtUserName.Text = ""
txtPassword.Text = ""
End Sub
|
|
|
|
|
Hi,
In which context your code doesnt work?
Do u get any error or exception? if yes then at which line?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
The code ran without any error messages and it sends the user's info such as username, password, etc to the database for storage. However, to my surprise when I check to see if it had checked for duplicate username when someone registers, it did not do so. The select statement was supposed to count the number of row in which UserName'{0}' = txtUserName.text. If the row count is greater than 0 then the username is already in use and an error message was supposed to fire. I don't know if that is the problem, it looks fine to me though. Please take a close look at the code, perhaps you'll find something I overlooked. Thank you again for your help.
|
|
|
|
|
Hi,
I think you will have to change your query.
When commandtext of Command object is a SELECT statement you should not use ExecuteNonQuery() method on it coz this method returns the total number of affected row. here in SELECT query it is not affecting any row hence it will return "-1" always it doesnt matter what the SELECT query is returning.
So according to me you should change you 'SELECT' query and also should call ExecuteScalar method on your command object.
Your query should be as following
strSQL = String.Format("SELECT Count(UserName) FROM myTable WHERE (UserName='{0}');", txtUserName.Text)
and you should call the ExecuteScalar function on your command which will return the count of username found.
Dim result As Integer = CType(myCommand.ExecuteScalar, Integer)
Now if the username is not found in the table then result will have value ZERO (0) otherwise it will have the count of username found in the table.
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
|
Hi all:
I have a comunications problem, and hope someone can help.
I have a page with a formview, [myForm.fvSpecies] in it, with the Insert method bound to a class method [clsSpecies.Insert], which itself calls an method in another class, [clsDBUpdate.Insert] that holds SQL.
This all works find, and on completion, [clsUpdate.Insert] (automatically behind-the-scene) raises an [ItemInserted] event that is trapped and handled by my [myForm.fvSpecies], as expected.
However, the problem occurs when I programmatically decide not to do the insert, eg if the user is not authorised.
AFAICS, the ItemInserted event arguments are identical, whether the actual insert happened or not (which is fair enough as the method [clsSpecies.Insert] completes, whether it calls [clsDBUpdate.Insert] and executes the SQL or not).
But what i want to do is to inform fvSpecies whether the update really occured or not.
I have tried to update the event-arguments of ItemInserted, but I cannot work out how, and I have tried to raise an event myself, but i cannot trap it: so please can anyone explain how my [clsSpecies.Insert] method can communicate with fvSpecies formview, via the ItemUpdated method or some other way, so I can be in control of the parameters and set a message or a code or something, myself, so the [myForm.fvSpecies] (or containing form myForm) knows what happened?
There must be a simple way to be in control of this communication, either by piggy-backing the automatic ItemInserted event or raising another event myself: but I cannot figure it out or find it.
Many thanks -
aitch
--x---
|
|
|
|
|
hello everybody iam a fresher,
how to get radio button in datagrid through property builder.
srinivas
|
|
|
|
|
There is a way for doing this ? I don't know because there is no way for doing this you can just use itemtemplate and put a radiobutton into this template and bind it whereever you want to...
Have a nice day..
|
|
|
|
|
i think u want to access the radiobutton through code..
if yes
then u have to find the radiobutton control in the datagrid row and then do whatever u want with it
|
|
|
|
|
I am getting problem with the IIS. when we right click properties of the virtual folder and in the configuration section to add new .dll in the execute section.
The OK button is getting disabled.
If anybody who worked. pls help me out.
Thanks in advance,
kartik
|
|
|
|
|
A potentially dangerous Request.Form value was detected from the client (myTextarea=<...").
I currently using ASP.NET
in my form contain textarea, when i type the normal text it work ok, but i type like this " " or something else in HTML i got error above, please help me.
Socheat
|
|
|
|
|
Add the line: <pages validateRequest="false" /> inside the <system.web> section.
6-shooter
|
|
|
|
|
If you set validateRequest = false then your request validation is not done. Rather, If you are using any special character which is passing from url, try to convert those special character into some form of combination, and when done convert back into special character.
Regards
Mahesh
|
|
|
|
|
Socheat.Net wrote: A potentially dangerous Request.Form value was detected from the client (myTextarea=<...")
Are you using "<" character. ASP.NET defaultly will not allow to postback with that characters. Add the ValidateRequest="false" in the @Page directive.
|
|
|
|
|
Thanks, i'll try my best.
Socheat
|
|
|
|
|
Hi,
You may solve this by setting the Page attribue ValidateRequest=false
Have a look at this[^] article for better understanding.
Regards,
Jay
|
|
|
|
|
Thanks, i found it very nice.
Socheat
|
|
|
|
|
Hi i displayed my datas in my form...,
When i give print option now those datas want to come in separate form and want to ask print like...,
See this option will be in gmail a/c...,
In our msg, when we click print option it will open separate from and those datas will be print...,
How to do like that?,
Plz hlp me,
Advance thanks...,
Magi
|
|
|
|
|
Hi friends,
I am working on a very large application in my company. It has very good framework implemented by the architects and designers.
In that framework I have needed to modify a class in one .cs file in one class library. I added 3 functions in that class. I am using existing typed datasets in those functions. From those datasets I have to filter data and return the resultant datacollection from the functions.
I have 2 approach to accomplish this.
1. To use Select() function on the table in the dataset and pass query to the function and get the filtered data.
2. To loop through all the rows in the table in the dataset and create collection of macthing rows and then return that collection from the function.
I need to know which approach is better and also is there any process which can be employed to check which approach from above two takes more time.
I have tried by putting datetime variables around the function calling and checking the difference between them but they show the same time with no difference at all.
So please can anyone guid me which is the better approach and how to measure the function performance.
Thank you all in advance.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|