|
If you want a control to run javascript, why make it a server control at all ?
This will work, so long as you spell 'disabled' properly, and so long as the Id is right. I tend to put something like this in my ASPX
<script language='Javascript>
var newNameId='<%=txtNewName.ClientID %>';
</script>
Or you can emit the code in your code behind with RegisterClientScriptBlock calls.
I put the rest of my script in a .js file. That way, I know my Id is always good. And, I make sure my code is spelled right.
I use firefox and firebug to debug my javascript. Without it, you're kind of lost at sea.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thank you Christian
I am using a TextBox which has Validators inside Footer Template of GridView, which i want to disable on the Click of Link Button Update.
I dont know if i can do this on client side?
And i believe because the txtNewName is inside the GridView i am not getting its ID.
When i am using the script
';
I am getting the Error txtNewName does not exists...
And Thanks for the tips. I will make sure about my spellings and using Firefox to debug my Javascript.
Thanks
Cheers
Menon
|
|
|
|
|
mady1380 wrote: And i believe because the txtNewName is inside the GridView i am not getting its ID.
OK, yes, that won't work. You'd have to do it within an event of the gridview control, the event that create the row with the textbox.
mady1380 wrote: I am using a TextBox which has Validators inside Footer Template of GridView, which i want to disable on the Click of Link Button Update.
Ah - you can write a custom validator which fires your other validators manually. Then, you can put the validator you want to control in a different group, and only fire it under certain conditions. This involves digging around in the .NET generated javascript, but it's quite doable.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thank you Christian
"you can write a custom validator which fires your other validators manually. Then, you can put the validator you want to control in a different group, and only fire it under certain conditions. This involves digging around in the .NET generated javascript, but it's quite doable."
I believe i will try Digging around for the Custom Validations
Thanks
Cheers
Menon
|
|
|
|
|
|
Thank you Abhijit
But its not working for me.
I just want to remind you again, that the TextBox is inside the Footer Template of my GridView.
Thanks
Cheers
Menon
|
|
|
|
|
i want a refresh button on my page.how can i code for this button?
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
|
But there is a difference between a Postback and a first call to a page.
And a refresh is the latter for me, though it's hard to say what a click on the browser refresh will do because it will send the last request again (postback or not).
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
A refresh will always refresh the last call made, otherwise how can it refresh page state. The way around this is to never show a postback, for a postback to redirect to the same page with URL parameters the restore state. Then a refresh will go to this page, and the page can be written so this performs no actions, it just shows the same state.
The other option is to have a button that links back to the page, which will not postback, but will lose any state derived from postbacks that have occurred.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
In the button click event of the Refresh button place the following code
protected void Button1_Click(object sender, EventArgs e)
{
Page.Response.Redirect(Page.Request.Url.ToString(), true);
}
Koushik
|
|
|
|
|
|
This is kind of useless. The page has already done a refresh, on the button, and it would just finish it's lifecycle without the redirect.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The page has done the refresh part but may be there are somethings to be done when Page.IsPostBack is false.
Koushik
|
|
|
|
|
hi all,,
i created .mdf file under my App_Data file if i am connecting to that data base..
i am getting the following error
"Failed to generate a user instance of SQL Server.
Only an integrated connection can generate a user instance.
The connection will be closed"
Can any body help me to fix this...........
|
|
|
|
|
hi!
asp.net Datagrid can display in row format?
Generally datagrid is displayed in column format
eg: A|B|C|D
but i want in A
--
B
--
C
it is very urgent,plz let me know the answer as soon as possible
thnx,
nimmi
|
|
|
|
|
Get it
Link1
Link2
Link3
bEST rEGARD
pATHAN
please don't forget to vote on the post that helped you.
|
|
|
|
|
Nirmala Jyothi wrote: it is very urgent
this won't really help you from getting fast answer. If you want fast answer, go and ask in some support forums.
Answer : Use a template column to get result like this.
|
|
|
|
|
Hello friends, I got this error in my application. What went wrong..and how to resolve it..I am using vs 2005..
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machinekey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machinekey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Source Error:
[No relevant source lines]
Source File: App_Web_adminlogin.aspx.4e1cade6.fhtclyxp.0.cs Line: 0
Stack Trace:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +2549708
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +214
[ViewStateException: Invalid viewstate.
Client IP: 10.8.6.6
Port: 1268
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7
ViewState: /wEPDwULLTE1NjYxMDU5OTgPZBYCAgMPZBYCAg0PDxYCHgdWaXNpYmxlaGRkZO2e2+a2WhZCITPLB7L6SRRWmvRV
Referer: http://watergenie.ca/test/webmaster/adminlogin.aspx
Path: /test/webmaster/adminlogin.aspx]
[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machinekey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +116
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +251
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
System.Web.UI.HiddenFieldPageStatePersister.Load() +220
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
System.Web.UI.Page.LoadAllState() +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.test_webmaster_adminlogin_aspx.ProcessRequest(HttpContext context) in App_Web_adminlogin.aspx.4e1cade6.fhtclyxp.0.cs
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
|
|
|
|
|
Obvious question: do you have a web farm?
If yes, do what exception message says. If not, it can be caused by someone (bot) acessing your site with cached (therefore probably invalid) viewstate.
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Hi all,
I have a dataset, i need to search for a string in the dataset. the dataset is not bound to any control. How can i do that? should i get any examples?
Thanking you in advance........
Sebastian
|
|
|
|
|
Hi Sebastian,
I think you can take each DataTable from DataSet and use DataTable.Select() command. This will return datarow collection.
Hope this helps
|
|
|
|
|
i have some numeric type value in the textbox.when i show the textbox value in the add watch , it shows the value in the double quotes.now the problem is how can i find out - if the textbox contains some numeric value - whether the textbox contans numeic value or not.
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
On the client, or the server ? You can do it on the server using regex. I believe javascript also has regex support, but I'm not familiar with it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
presently i am debugging my program
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|