|
Well I dont know enough about your situation to make that call. You could even do it at the database level if you are using stored procedures, but in most cases thats probably not a good idea.
Also what are you trying to accomplish specifically? If you dont want the user changing stuff why not just make the fields readonly?
If you have a specific reason why not and in a situation where you are already loading data from a database during a request, keeping it in a session object, and then showing that data to a user in a textbox, then on postback you will already have that data on your server and won't need to go back to the database to do your comparison, the original data is already there on the server. Personally I think it would be best practice to check it on the server. Since either way you are going to be testing equality on some field (be it a string or a changed-flag).
Are you validating any other fields on the page with javascript? Then you could lump your comparison in there with the validation, but then you'd need to create hidden fields and it might be too complex and not worth the small performance gain you would get when substituting a string compare with the changed field bool.
Sorry for rambling
|
|
|
|
|
The senerio I have is pretty simple. If the user makes any changes to the data in the textboxes on the page the logic that updates the database needs to update one of the table fields with a 0 otherwise use the existing value. Hence, I need to check if any changes were made on the page.
From what I have read using a session varable to store datatable rows is a server resource hog so instead I requery the database each time I need to.
And no I am not validating fields on the page with javajscript. Instead I have a class method to do the validating.
So to check if a user changed data on the page I should use some javascript?
|
|
|
|
|
If storing the data in a session is a problem for you then JavaScript will work, yes. Hope I've helped with your problem!
|
|
|
|
|
What kind of change are we talking about? Do any of the validation controls help you?
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
hy,
i made a Web Service project in visual studio 2008.
then added 2 "Web Service" files to the project.
Service1.asmx
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <system.web.script.services.scriptservice()> _
<system.web.services.webservice(namespace:="http://tempuri.org/")> _
<system.web.services.webservicebinding(conformsto:=WsiProfiles.BasicProfile1_1)> _
<toolboxitem(false)> _
Public Class Service1
Inherits System.Web.Services.WebService
<webmethod(true)> _
Public Function HelloWorld() As String
Session("foo") = "bar"
Return "Hello World"
End Function
End Class
Service2.asmx
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <system.web.script.services.scriptservice()> _
<system.web.services.webservice(namespace:="http://tempuri.org/")> _
<system.web.services.webservicebinding(conformsto:=WsiProfiles.BasicProfile1_1)> _
<toolboxitem(false)> _
Public Class Service2
Inherits System.Web.Services.WebService
<webmethod(true)> _
Public Function HelloWorld() As String
If Session("foo") <> "bar" Then
Throw New UnauthorizedAccessException
End If
Return "Hello World"
End Function
End Class
After i made a windows application, where i made a "Service Reference" to both web service classes/files.
The problem is that Service1.asmx doesn't share it's session with Service2.asmx,...
I get the thrown "UnauthorizedAccessException" on calling "Service2.HelloWorld()" because the session is not created in Service2.asmx after calling Service2...
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim bhp As New System.ServiceModel.BasicHttpBinding
bhp.AllowCookies = True
Dim x As New ServiceReference1.Service1SoapClient(bhp, New ServiceModel.EndpointAddress("http://localhost/ImsBrowserWebService/Service1.asmx"))
Dim y As New ServiceReference2.Service2SoapClient(bhp, New ServiceModel.EndpointAddress("http://localhost/ImsBrowserWebService/Service2.asmx"))
MsgBox(x.HelloWorld)
MsgBox(y.HelloWorld)
' Dim x As New localhost.Service1
' MsgBox(x.HelloWorld())
' Dim y As New localhost1.Service2
' MsgBox(y.HelloWorld())
End Sub
End Class
How to share the session between those files,... In Visual Studio 2003 it works fine when calling the service from javascript,... Now in visual studio 2008 with the soap client wizards it doesn't...
Any help would be welcome,
...
It feels good to learn and achieve
|
|
|
|
|
i think it's impossible,
please tell me the answer
|
|
|
|
|
Hi All,
I have used a TreeView control which is placed in a Div tag in the master page. Whenever the TreeView controls items exceeds the limit of the Div tag it gives the vertical and horizantol scroll bars. It is Ok.
But when the items are not exceeding still it is giving the scroll bar in disable mode. What I want is the scroll bars should not appear when the items are within the limit means when the scroll bars are in disable mode they should not be visible and when they are enabled they should be automatically visible.
I want to do it by using any CSS class. Can anybody advice me to do it by using any CSS class.
Thanks,
Md Abdul Aleem
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
|
Hi All,
I read the link but I am unable to judge it satisfies my condition or not.
I have a div tag as below and I want to make the scroll bar invisible when the tree view control is within the div tags limit means when it is not required the scroll bars should become invisible and when the tree view opens and exceeds the limit of the div tag the scroll bars should come automatically.
<div id="TreeViewContainer2" class="inline">
<asp:TreeView ID="treeId" runat="server" SkinId="ExplorerLines" onselectednodechanged="treeId_SelectedNodeChanged" ExpandDepth="1" OnUnload="treeId_Unload" ForeColor="#000099"></asp:TreeView>
</div>
Can anybody please help me in doing this.
Thanks in advance,
Md. Abdul Aleem.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
Hi,
I have some short questions about locking threads in ASP.NET. Normally I use C# console/winforms but in this case I need to write it in VB for ASP.NET. My questions are there any drawbacks to this code in a high-volume of requests? Is this completely wrong for an ASP.NET application? If so what do you recommend? The purpose here is to lock a timestamp and be sure it is set uniquely throughout all the sessions on the web server:
Protected Shared TimeStamp As Date
Protected Shared Sub SetUniqueTimeStamp()
Try
' Request the lock, and block until it is obtained.
Monitor.Enter(TimeStamp)
' When the lock is obtained, set the Timestamp.
TimeStamp = Now
Finally
'Guarantee at least 1ms tick for uniqueness
Thread.Sleep(1)
' Ensure that the lock is released.
Monitor.Exit(TimeStamp)
End Try
End Sub
This is just an example based on some code I altered from this at MSDN: Monitor.Enter Method[^]
Many thanks in advance!
modified on Tuesday, April 14, 2009 10:02 AM
|
|
|
|
|
Hi All,
Im looking for a free solution/approach to capturing video from a clients webcam and sending back the recorded video to my server (IIS).
Flash player, Javascript, silverlight, asp .net, etc..
Any Ideas?
Thanks
M
|
|
|
|
|
i am using sql server 2005 express and i have one web site which is i have published and installed on machine but when connecting to sql server 2005 express getting error login failed mycomname/ASPNet user why not taking user name insted of aspnet how do i login my con string is as follws
<add name="EMSConnectionString" connectionString="Data Source=.\sqlexpress ;Initial Catalog=EMS;intigrated security=true" providerName="System.Data.SqlClient"/>
|
|
|
|
|
nikhil1234 wrote: why not taking user name insted of aspnet how do i login my con string is as follws
<add name="EMSConnectionString" connectionstring="Data Source=.\sqlexpress ;Initial Catalog=EMS;intigrated security=true" providername="System.Data.SqlClient">
Your web application is running in the context of the ASPNET user. Therefore, when you use integrated security you will log in with the credentials of the user that your process is running as. This is the correct functionality.
You must grant the appropriate access to the ASPNET user to the database.
Possibly the reason you did not see this when you were developing the web site is that Visual Studio has its own built in Web Server that uses your credentials. When you deploy to IIS you use the credentials IIS uses.
|
|
|
|
|
intigrated security=true
integrated security=true
Try that.
var question = (_2b || !(_2b));
|
|
|
|
|
It is true by default, so that typo would likely have been ignored.
|
|
|
|
|
Fair enough, I probably should have read the question first, but that typo kinda blinded me straight on.
And thanks, I didn't know Integrated security was true by default.
var question = (_2b || !(_2b));
|
|
|
|
|
hi
function window.onunload()
{
if (window.event.clientX < 0 && window.event.clientY < 0)
{
//call Session.Abandon()
}
}
in above funcion i am check browser closed button is press or not when button is press i want to close the session just like a Session.Abandon()(server side function). and second question is my project above 200 web form are there and every page redirect to another page so how can i used above code only single time
|
|
|
|
|
You can do one thing
if(window.event.clientX < 0 && window.event.clientY <0)
{
window.open("CloseSession.aspx", "OpenWindow_Close_Session",'left=12000,top=1200,width=10,height=1');
}
In CloseSession.aspx Page Load Do the server side task and make it self.Close();
protected void Page_Load(object sender, EventArgs e)
{
Session.Abandon();
string strPopupScript = "<script language="javascript">self.close();</script>";
Page.ClientScript.RegisterStartupScript(typeof(Page), "PopUpScript", strPopupScript);
}
Hope this will help you.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
but sir i cannot put this code my above 200 web page
|
|
|
|
|
So you don't have master page ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
you don't have to. Another alternative is create web handler page (ashx page) put the functionality Abhijit provided in the ProcessRequest call it using ajax.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Yup Excelent... That is the best option, if you don't have the master page you can simply do it using handler other wise write the same in master page.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
I am facing a unique problem (looks unique to me at least). I have a dropdown whose auto-postback is enabled. User can select a value from the dropdown to go to another page. But when the user comes back to original page by clicking the back button on the browser and clicks any button then on the post-back caused by the button, first the "SelectedIndexChanged" event handler of that dropdown is called then the "Click" event handler of this button is called. Hope I have explained the problem clearly.
Can anyone tell me what's going wrong and how to solve the issue?
|
|
|
|
|
Just put the code that you have written for redirect to different page of Dropdownlist SelectedIndexChanged.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
I did the same but it is not working......looks like the browser is remembering the previous state of the page and so is causing the previous event to be raised in addition the present event..... I think I have to take help of javascript. Thank for the reply
|
|
|
|