.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Event Handle & Declared Message Errors

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
Hi Experts: There is a missing event Handle that requires a variable found in the button code . Secondly,  there is a Name declared error (i.e., Name 'First' is not declared, Name 'Last' is not declared, Name 'City' is not declared, Name 'State' is not declared) found in the page code. How do we revise the codes to remove the message errors? Go to the following URL link to view 'High Res' screen shots at http://cforedu.com/screen.pdf Here is the page code:<%@ Page Language="VB" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <script runat="server"> Protected Sub Save(sender As Object, e As EventArgs) Dim First As TextBox = TryCast(Me.fvApplication.FindControl("First"), TextBox) Dim Last As TextBox = TryCast(Me.fvApplication.FindControl("Last"), TextBox) Dim City As TextBox = TryCast(Me.fvApplication.FindControl("City"), TextBox) Dim State As TextBox = TryCast(Me.fvApplication.FindControl("State"), TextBox) End Sub </script> </head> <body> <form id="form1" runat="server"> <div> <asp:FormView runat="server" ID="fvApplicatio

View Complete Post

More Related Resource Links

how to handle the next event on createuserwizard

down vote favorite   Hi, Does anyone know how to handle the next button on createuserwizard control asp.net? I need to validate some fields before the user can navigate to the next step.

listview with button in item template - how do I handle the click event?

Hello,Using a listview control for the first time... I need a button for each item, and of course I need to handle the click event for the buttons... upon clicking a particular button I of course need to know which item the button is associated with so the appropriate action can be taken...In VS, I can't select the button and see my list of available events in the properties window like is normally done for controls outside of templates like this... what do I need to do?

SPUtility.TransferToErrorPage("My Message") not allowed to attach any controls event.

Hi, I have created a custom error page and update it using to webApplication using following code: WebApplication.UpdateMappedPage(SPWebApplicaton.SPCustomPage.Error, CustomErrorPage) My error page contains one link button and onClick event, I have to perform some operations. As I click on the button Error is occurred and onClick event code didn't execute. If I render custom error page by providing url in IE like http://myweburl/_layouts/myerrorpage then every thing is working fine i.e. every event is working fine. Also If I use SPUtility.Redirect() method instead of SPUtility.TransferToErrorPage() then also every thing is working fine. My error message is as follow in case of SPUtility.TransferToErrorPage(): 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. StackTrace is [HttpException (0x80004005): Unable to validate data.]    System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +10988853    System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +295 [ViewStateException: Invalid viewstate. Client IP: fe80::8960:150e:cf5d:2e17%11 Port: 53192 User-Agent: Mozill

Handle MaxLength changed event for TextBox

Hi, Is it it possible to handle the event when MaxLength property is changed on a TextBox? Thanks, cp

How to implement handle externl event activity by my code?...

As a programmer, I write some code to practice wwf, and I have implemented the **call external activity** by using reflection. 1. Firstly, define a xml document that contain a plugin detail: <xml version="1.0" encoding="utf-8" > 2.Secondly, call the external method by reflection in some codes: Assembly assembly = Assembly.Load(assemblyName); Type myInterface = assembly.GetType(interfaceName); Type myClassType = null; foreach (Type t in assembly.GetTypes()) { if (myInterface.IsAssignableFrom(t) && t.IsClass) { myClassType = t; break; } } MethodInfo methodInfo = myClassType.GetMethod(method); object instance = Activator.CreateInstance(myClassType); object result = methodInfo.Invoke(instance, userData); But when I implement the handle external event pattern, i can't finish it by using reflection directly, then i want to hookup delegate, still faild. It seems that the mothod **addService(service)** do somethings inside the wf side. Could I still implement it by use reflection? Actualy, I don't know the detail about when the host client raise an event, how wf side can recieve this action. it seemed that this is the key for my question... Thanks ligong

7888 and 5553 Errors in Event Log

Hi,   I keep getting   7888 A runtime exception was detected. Details follow. Message: Cannot insert duplicate key row in object 'dbo.UserMemberships' with unique index 'CX_UserMemberships_RecordId_MemberGroupId_SID'. The statement has been terminated. Techinal Details: System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object 'dbo.UserMemberships' with unique index 'CX_UserMemberships_RecordId_MemberGroupId_SID'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolea

Background worker - errors in completed event

Create a new windows forms project (in using vb.net 2010). Create a button and a background worker on the form. Under the Debug > Exceptions menu, make sure that for 'Common Language Runtime Exceptions' you have 'Thrown' unticked and 'User-unhandled' ticked. Now put the following code in the form's code-behind; Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BackgroundWorker1.RunWorkerAsync() End Sub Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork Threading.Thread.Sleep(2000) End Sub Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted Dim X As Integer X = 5 / X End Sub End Class Why does it not error nicely? It comes up with no helpful stack trace and just says 'Exception has been thrown by the target of an invocation.'. Place the code to cause the error into the Button_Click event and run it and you will see the difference. Why do we not get these 'nice' errors given that the runworkercompleted event is supposed to be running on the main thread?

How to display a prompt message from gridview_deleting event

Hello, i am following a code example to prompt user before delete and have a reference to the commandfield Delete linkbutton.But something is missing because nothing happen when executed.  Gridview1_Deleting linkBtn.OnClientClick = "return confirm('Are you sure you want to delete this entry?');" end sub <Columns>                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />

Pop-up message in event handler

Hi All, I am writing a item insert validation in "ItemAdding Event" of event handelr. After validating the page is redirecting to the error page showing the custom error message. My requirement is ... Instead of moving to the error page the custom error should display in a pop-up dialog box on the same page. If I will click on the ok than the page should not redirect to any where(the focus should be in the same page) and the value in the field should not reset. Please help me..

Event receiver validation client message


Is thera a way to display a client message if validation sets. (java script or inline validation error message)

properties.Status = SPEventReceiverStatus.CancelWithError;

properties.Cancel =



properties.ErrorMessage =


How to handle treeview selected node changed event



From my below sample code, I don't want to use Sessions to handle each click event inside treeview selected node changed.

Secondly, if you suggest me to use treenode.SelectedValue then I would say my values are dyanmically generated.

Everytime a node a clicked, the selected node value is sent in the next request xml to get response and xml schema is different for each click. How do I handle this each click event other than using session variables. I thought of using Request.Item (and integrating with URL redirect property) but I don't want to use that.


Dim trNode As New TreeNode
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then        
            trNode.Text = "Not Postback"
            Session("Flag") = 1
        End If
    End Sub

Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TreeView1.SelectedNodeChanged
        If Session.Item("Flag") = 1 Then
            trNode.Text = "Is PostBack"
            Session("Flag") = 2
        End If

Custom Message onbeforeunload event.


Hello All,


I need to prompt user when he/she leave from page without save changes.

I had achieved that thing but the problem is that

it displays it own message I need to display my message only.

So I have used onbeforeunload event in javascript.

Please give me snip code if possible so that I can find solution easily.


The Code that I had written is,


function SetDirty() {




window.onbeforeunload = closeIt;

RMS and MOSS message errors


Hi All,

We use a MOSS farm Ent SP2, the RMS is not configured and we don't use it, but sometimes the following error appears:

Information Rights Management (IRM): There was a problem when trying to find the enterprise Rights Management Services (RMS) server.

There was no enterprise server registered.

Additional Data

I have checked in the Central Admin and RMS is not confugred , how I can avoid this message?

Thank you,






Application Event Log Errors (event id 8031 and 5553)


I'm not sure if it's related, but I recently removed an old Search Service Application from my server and I keep getting the following two event log errors. Everthing seems to be working fine, but I'd like to clear up the errors. Any ideas?

Log Name:      Application
Source:        Microsoft-SharePoint Products-SharePoint Portal Server
Date:          6/4/2010 10:00:08 AM
Event ID:      5553
Task Category: User Profiles
Level:         Error

Computer:      TST-M10RTM-APP.domain.com

failure trying to synch site c2e96f78-9bd7-404d-a376-0809b6a1eece for ContentDB f0d6d51f-ebd8-44f1-9445-2eec259141ed WebApp 2b25fc24-e146-4e50-990d-5107c3ceeaad.  Exception message was Procedure or function profilesynch_MS_DeleteWeb has too many arguments specified.
The 'profilesynch_MS_UpdateWeb' procedure attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead..
Event Xml:
<Event xmlns="http://sc

Windows Application Log Event Errors writing back to SharePoint Library fields


Hi has anyone done anything like this?

My Library workflow is writing to an External List (MS SQL backended).  If an exception is thrown in MSSQL (Stored Procedure, Trigger, etc) I would like to create a mechanism for writing something back to my Library besides the workflow column saying "Error Occured".

I could create a text field to provide some error feedback, anybody ever did something like this?


Failure Message Object WSS_Content_MyActiveSite failed in event OnBackup




Hey Guys,

I am hoping you can help me with my backup issues.  I am currently trying to run a backup and I keep getting the same error message (whether it is a full, farm, or differential).


For this example I am just trying to backup my active site and i get the following error message.


Object WSS_Content_MyActiveSite failed in event OnBackup. For more information, see the spbackup.log or sprestore.log file located in the backup directory


when I check the log, i get the following information:


10/6/2010 1:36:35 PM] Verbose: Starting OnBackup event.
[10/6/2010 1:36:35 PM] Verbose: Starting object: SharePoint - My Active Site.
[10/6/2010 1:36:36 PM] Verbose: Starting object: WSS_Content_MyActiveSite.
[10/6/2010 1:36:36 PM] Progress: [SharePoint - My Active Site] 50 percent complete.
[10/6/2010 1:36:36 PM] Verbose: Starting object: job-workflow-failover.
[10/6/2010 1:36:38 PM] Progress: [job-workflow-failover] 50 percent complete.
[10/6/2010 1:36:38 PM] Verbose: [WSS_Content_MyActiveSite] SQL Server Connection String: Data Source=SV03MIS017\SHP1;Initial Catalog=WSS_Content_MyActiveSite;Integrated Security=True;Enlist=False;Connect Timeout=15.
[10/6/2010 1:36:38 PM] Verbose: Starting object: ExpirationProcessing.

net.tcp message formating errors Message.GetBody


Man! I have been trying to figure this one out... but with no luck. In the end, all i am trying to do is notify the client with the payload being an object graph more complex than a simple value type.

I am getting an error when using the GetBody method of the message object. 

the typed message converter reference


private static TypedMessageConverter _ClientReportStatusMessageConverter = TypedMessageConverter.Create(


the report status message object

 /// <summary>
  /// The client report status message is used
  /// to transfer report status change messages
  /// to the client
  /// </summary>
  public class ReportStatusMessage

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend