Update Button event not firing ??

rated by 0 users
This post has 1 Reply | 1 Follower

Top 500 Contributor
Male
Posts 74
Points 935
MamboRocks Posted: Wed, Apr 2 2008 3:52 AM

usercontrol code ::

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WhyJoined.ascx.cs" Inherits="CommunityServerWeb.Themes._default.User.WhyJoined" %>
<%@ Import Namespace="CommunityServer.Components" %>
<%@ Import Namespace="CommunityServer.Controls" %>
<asp:UpdatePanel runat="server" ID="joinpanel" ChildrenAsTriggers="true" UpdateMode="Always">
<Triggers>
 <asp:AsyncPostBackTrigger ControlID="dgwhyjoined" EventName="UpdateCommand" />
 <asp:AsyncPostBackTrigger ControlID="dgwhyjoined" EventName="EditCommand" />
 <asp:AsyncPostBackTrigger ControlID="dgwhyjoined" EventName="CancelCommand" />
</Triggers>
<ContentTemplate>
<asp:DataGrid ID="dgwhyjoined" runat="server" 
    oncancelcommand="dgwhyjoined_CancelCommand"
    oneditcommand="dgwhyjoined_EditCommand"
    onupdatecommand="dgwhyjoined_UpdateCommand" AutoGenerateColumns="false" >
    <Columns>
   
        <asp:TemplateColumn>
      
        <ItemTemplate>
            <asp:Label ID="lblmsg" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"WhyJoined") %>'></asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="txtmsg" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"WhyJoined") %>'></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateColumn>
        <asp:EditCommandColumn CancelText="Cancel" UpdateText="Update" EditText="Edit"></asp:EditCommandColumn>
            </Columns>
        </asp:DataGrid>
</ContentTemplate>
</asp:UpdatePanel>

 

codebehind file

 

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CommunityServer.Controls;
using CommunityServer;
using CommunityServer.Components;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using CommunityServer.Discussions.Components;
using CommunityServer.Files.Components;

namespace CommunityServerWeb.Themes._default.User
{
 public partial class WhyJoined : System.Web.UI.UserControl
 {
  protected void Page_Load(object sender, EventArgs e)
  {
           
                binddata();
          
          
          
  }
      
        private void binddata()
        {
            DataTable table = new DataTable();
            table.Columns.Add("WhyJoined");
            table.Rows.InsertAt(table.NewRow(), 0);
            table.Rows[0]["WhyJoined"] = CSControlUtility.Instance().GetCurrentUser(this).GetExtendedAttribute("WhyJoined").ToString();
                     dgwhyjoined.DataSource = table;
            dgwhyjoined.DataBind();
        }

        protected void dgwhyjoined_CancelCommand(object source, DataGridCommandEventArgs e)
        {
            dgwhyjoined.EditItemIndex = -1;
            binddata();
        }

       

      

        protected void dgwhyjoined_EditCommand(object source, DataGridCommandEventArgs e)
        {
            dgwhyjoined.EditItemIndex = e.Item.ItemIndex;
            binddata();
        }

        protected void dgwhyjoined_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            TextBox txtwhyjoined = new TextBox();
            txtwhyjoined = (TextBox)e.Item.FindControl("txtmsg");
            CSControlUtility.Instance().GetCurrentUser(this).SetExtendedAttribute("WhyJoined", txtwhyjoined.Text.ToString());
            dgwhyjoined.EditItemIndex = -1;
            binddata();
        }
 }


I have managed to get a grid inside a update panel(without full page post back) where i am able to get update and cancel buttons on clicking edit button.but when i click on update the event is not gettting fired ..what might be the problem.???

  • | Post Points: 5
Top 500 Contributor
Male
Posts 74
Points 935

 ??

  • | Post Points: 5
Page 1 of 1 (2 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com