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

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

RowUpdating event not firing

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :ASP.Net


I have tried to google on this topic but can't seem to find a good answer on why the rowupdating event is not firing. I have converted my edit and delete fields to template fields. I have written a code for GridView RowUpdating event. when I click on Update, I get the following error:

Updating is not supported by data source 'GridView_DataSource' unless UpdateCommand is specified.

Here is my HTML code:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ProjectID,ClientID"
            DataSourceID="GridView_DataSource" Height="229px" OnRowCancelingEdit="GridView1_RowCancelingEdit"
            OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" Style="z-index: 100;
            left: 59px; position: absolute; top: 101px" Width="486px">
                <asp:TemplateField HeaderText="ProjectID" InsertVisible="False" SortExpression="ProjectID"
                        <asp:Label ID="projectid_l

View Complete Post

More Related Resource Links

GridView RowUpdating event

Hi,I have a gridview. In the rowupdating event, the txtbox returns null. I have enabled viewstate for the gridview. But still it does not work. I have made this in Kentico. Please help.<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"        AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1" EnableModelValidation="True"        OnRowUpdating="GridView1_RowUpdating" >        <Columns>            <asp:CommandField ShowDeleteButton="True" CausesValidation="false" ShowEditButton="True"                ControlStyle-Width="100px" />            <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Name" SortExpression="name">                <ItemTemplate>                    <as

MouseUp event not firing on ActivityDesigner class?

I have a custom control derived from ActivityDesigner.  I'm basically retemplating the contol to give it a stylized look and feel ... I want to add the ability to change the Display Name by swapping out the TextBlock with a TextBox on MouseUP - but this event is not firing. I can handle the MouseDown event and it works OK, except it enters the Edit mode when dragging the activity around.  Is the MouseUp handled at the base level?  Is there a way to work around this? 

how to use nested gridview's rowupdating event

Hi all,            I have a GridView within a GridView. I want o access child gridview's rowupdating event. i want to update row.            this is my GridView's code as follows<asp:GridView ID="grdv1" runat="server" AutoGenerateColumns="false" EmptyDataText="No records found" OnRowDataBound="grdv1_RowDataBound" CellPadding="0" Width="500px" CellSpacing="0" BorderWidth="0"> <Columns> <asp:TemplateField> <ItemTemplate> <table width="100%"> <tr> <td align="center"> <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' CssClass="nbdcontent"></asp:Label> </td> </tr> <tr> <td style="height: 150px"> <asp:GridView ID="grdv2" runat="server" AutoGenerateColumns="False&

Disable Login event firing in SP 2007

hello, how can i disable the login event firing in sharepoint ?...i just want to disable the sign in event 

Sharepoint Event Handler not firing

I have written an event handler for an ItemAdded eventfor a document library. I am trying to read an excel file being uploaded and extract a value from it which I write to a list column for the item. I have this working properly on my development machine which is a Windows Server 2003 machine.However, on a production Windows Server 2008 machine, the event handler never fires. I am doing a simple write to a log file to test and see if it runs at all even if the Excel parsing does not work but I get no indication that it ran. The event handler is being registered with a feature that I am deploying. I have verified that the event handler is registered to the library by using the u2u Event Handler Explorer tool.Is there any way I can determine if my event handlers are even executing? How can I debug this?

ItemAdded Event Handler not firing

Hi, I have created an ItemAdded Event handler that is linked to a content type. This event handler does certain custom validations and then sends Email to users. I have referenced this event handler in XML file as well but somehow the event handler is not getting fired...Following is the code.   Code Snippet            this.DisableEventFiring();            using (SPSite site = new SPSite(properties.SiteId))            {                 using (SPWeb web = site.OpenWeb())                {                    base.ItemAdding(properties);                     SPList nList = web.Lists["NList"];                    SPList IList = web.Lists["IList"];                     foreach (SPListItem listItem in nList.Items)                    {                        if (listItem["Topic"].ToString() == properties.ListItem["Topic"].ToString())                        {                            SPUser alertUser = (SPUser)(properties.ListItem["SUser"]);                            SPUtility.SendEmail(web, false, true,alertUser.Email,"New item added", "A new item has been added");                         }                    }                    this.EnableEventFiring();                }            }       The XML file is: Code Snippet  <XmlDocuments>      <XmlDocument NamespaceURI="http://schemas.microsoft.com/

click event only firing for lower 100 pixel portion of vertical div

 I have a div on the left side of my page. when clicked I toggle a hidden div that flies out to the right. But the click event only works on the bottom portion of the div. The hidden div has a close button div in the lower right. to clicks fine. any ideas? code is below jquery <script type='text/javascript'> $(document).ready(function() { var $scrollingDiv = $("#divReportBanner"); $(window).scroll(function(){ $scrollingDiv .stop() .animate({"top": ($(window).scrollTop()) + "px"}, "fast" ); }); $('.toggle-button').click(function() { $("#divLeftMenuBody").animate({width:'toggle'},400); }); $('#divReportBanner').click(function() { $("#divLeftMenuBody").animate({width:'toggle'},400); }); }); </script> html <div id="divReportBanner" ></div> <div id="divLeftMenuBody" runat="server"> <div style=" overflow: scroll; overflow-x:hidden;width:365px; height:370px;">

On click Dialog Box to browse file...NOt firing serverside event...

<script type="text/javascript">    function Open()    {         var fileupload=document.getElementById('fupload');                      fileupload.click();  //       document.form1.submit();    }       </script>protected void Page_Load(object sender, EventArgs e)    {btnimport.Attributes.Add("onclick", "javascript:return Open();");    }<asp:Button ID="btnimport" OnClick="btnimport_onclick" runat="server" Text="Import"/>                                                        <input type="file" runat="server" style="display: none" id="fupload" />protected void btnimport_onclick(object sender, EventArgs e)    {        if (ViewState["CurrentTable"] != nu

List Event Receivers firing for all custom lists

Hello, I have a site with two custom lists, and I have created an EventReceiver class to handle the ItemAdded event for custom lists. I have modified the EventReceiver's Elements.xml file to only handle items added to one of the custom lists instead of all custom lists, by changing: <Receivers ListTemplateId="100"> to <Receivers ListUrl="/Lists/MyCustomList">   however, when debugging, the ItemAdded method is being fired when an item is added in both custom lists. I have had to work around this by checking within the ItemAdded method for the list that fired the event:        public override void ItemAdded(SPItemEventProperties properties)        {            base.ItemAdded(properties);            if (properties.ListTitle.Equals("My Custom List")) { ... } I thought the ListUrl attribute of the Receivers element specifies the event to only fire for the specific list with that url? (see http://msdn.microsoft.com/en-us/library/ms431081.aspx). Is there somewhere else I should be checking?   Thanks

Drop Down Listbox SelectedIndexChanged Event not firing when I programmatically change selection

I have two drop down listboxes (DDL1 and DDL2).  When DDL1 has an index change, DDL2 then has a refresh of list items based off SQL Server SELECT from a table.  The database isn't the problem.  Everything works perfectly when the user selects a new item manually from DDL1.But in my code, I save the user data from the selection of DDL1 in a separate table.  And then upon rendering of the page (Page_PreRenderComplete), I do a SelectedIndex assignment of the value of what's saved in the db table.  That works just fine, it selects the DDL1 item, but DDL2 is unaffected, as if DDL1's SelectedIndexChanged event isn't called like it would be if manually changed.  How can I get around this?Thanks in advance. :)

ProcessCmdKey event not firing

I have a fairly involved form that is composed of a lot of telerik controls and also has a ChartDirector chart in it.  I am trying to manipulate a cursor in the chart that will skip from one point to another, and I want to use the arrow keys as one method to move the cursor. I have overridden the ProcessCmdKey event in the Form class that hosts all the controls, and it never fires in my application (I put in break points to be sure).  I have tested the exact same code in a newly created RadForms object that also included similar controls (though not as extensive), and it works just fine.  My conclusion is that there is another event that gets fired first and is intercepting the information before ProcessCmdKey sees it. Is this a reasonable assumption, and if so, does anyone know which event might be being fired and know of a way to check what it's doing?  This single form has a few thousand lines of code, and a truckload of event handlers, so excising them one by one will be time consuming. thanks, David

KeyDown event on a Form is not firing for STX and/or ETX

I'm using a wireless barcode reader that's inputting data using HID. I've configured it to wrap the output between STX and ETX (0x02, 0x03), however, i never get any KeyDown event generated when those keys are sent from the device, the barcode keys are sent just fine but not STX and ETX.

FormView Command Button not firing Item Command Event

Hi, In my content page, I have a formview for Insert & Edit. In insertitemtempalteI have a command button (btnInsert) to trigger  Item_Command event to insert a new record. The button event never gets triggered. But If I set CausesValidation = "false"it fires. But I want the validation to take place. I tried btnInsert_command and btnInsert_Click events. None of them is fired. Ideally I would like to havethe item_command event fired. I would appreciate any inpyt on how to handle this problem. <FormView>     <InsertItemTemplate>            .....           <div>               <asp:Button id="btnInsert" CommandName="Insert" Text="Insert" runat="server" UseSubmitBehavior="true" />              <asp:Button id="btnCancel" CommandName="Cancel" Text="Insert" runat="server" />           </div>     </InsertItemTemplate></FormView>   Thanks Suresh

dynamically created button control click event not firing first time?

HI im creating a button control in page int and im assing a click event for the button control. here the click event is not firing for the first time.can anyone help me with this? here is my code. Button btn = new Button(); btn.ID = "btn"; btn.Click += new EventHandler(btn_Click); Panel1.Controls.Add(btn); Panel1.Controls.Add(new LiteralControl(""));

Connect InfoMessage event is not firing

I'm not able to fire the SQL Connection’s InfoMessage event - here's the code that I've set up The normal message that i'd expect to see in mSQLMessage is "(12 row(s) affected)"  but the mConnect.InfoMessage is not firing.  Any ideas what I'm missing? Public Class Dispatch     Private WithEvents mConnect As SqlConnection         Private Sub SaveSQLMessages(ByVal sender As Object, ByVal e As SqlClient.SqlInfoMessageEventArgs) Handles mConnect.InfoMessage         mSQLMessage &= e.Message & vbNewLine     End Sub     Public Function GetDatatableofJobs() As DataTable         Dim ds As New DataSet         mConnect = New SqlConnection         mConnect.ConnectionString = mStrConnect         Try             mConnect.Open()             Dim da As New SqlDataAdapter("Select * from dbo.vGetPriceItJobs", mConnect)             da.Fill(ds, "Jobs")         Catch ex As Exception   &nbs

URL Routing + PostBack not firing BeginRequest event


hi all,

we are having some weird issues with URL Routing in ASP.NET 3.5. 

We have a search box that does a search and redirects to a routed URL.

 When we search for the first time (aka Press a button that forces a postback) everythign works as expected.  we get:

1. BeginRequest event.

2. Determines Route

3. Calls Routehandler to match the route item to the actual destination page

4. Routes the url appropriately.

After you do one search successfully and try again it fails to call the BeginRequest event.  Because of this the routing data never gets called and so the url is never routed to its correct destination.   What is weirder still if we append a "/" (trailing slash) to the url after the initial postback it DOES work properly again. 

So our search route looks like this


entering a term and pressing the SEARCH button would yield a result url like this:



Going back (after 1 successful search) you then need to use this url or else BeginRequest will never fire:

mydomain.com/Search/ < (note the extra "/" at the end)


Anyone have an idea a

Custom WebPart .LoadControl(.ascx) event not firing


I am creating a Webpart which loads a custom control (.ascx) in the CreateChildControls Event

        protected override void CreateChildControls(EventArgs e)

            _userControl = Page.LoadControl(@"/_controltemplates/ControlTemplates/CustomUserControl.ascx");
            _userControl.ID = "usrSearchResults";


In the codebehind of this user control (I am using the inherits model as in ASP.NET 1.1) I have an InitializeControls method which binds the eventhandlers to an already existing DropDownList on the user control.

Markup in the .ascx file
    <asp:DropDownList ID="ddlRegions" AutoPostBack="true" runat="server" DataTextField="Title"
        DataValueField="Title" EnableViewState="true">

EventHandling code in the code behind of the user control.  This code runs in every Page_Load event.

ddlRegions.DataBound += new EventHandler(ddlRegions_DataBound);
The problem is that when the selected values in the dropdownlist changes the event handler does not fire (a post does occur though).  Am I missing something here?

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