Button ajaxevent

  1. #1

    Button ajaxevent

    Hi everyone,

    I am trying to display number of counts (record count) in a label. When I try a normal ASP Button control, the count displays in the label control. but when i use a ext:button control, it does not display the count. I debugged it and the method gets the count from database. Nothing changes in the code behind for both button controls.
    I have tried it with/without update panel for both controls.

    Do you know the reason why?

    thanks in advance for your help.

    Kamal
  2. #2

    RE: Button ajaxevent

    Last edited by geoffrey.mcgill; Feb 19, 2011 at 5:43 AM.
    Geoffrey McGill
    Founder
  3. #3

    RE: Button ajaxevent

    Hi Geoffrey,

    Here is my code behind the control
    
    
    
    protected void cmdgetwebcount_Click(object sender, EventArgs e)
    
    
    {
    
    
    try
    
    
    {
    
    
    Label labeldateimported = (Label)this.dtviewsimpledata.FindItemControl("lbldateimported", dtviewsimpledata.VisibleItems[0]);
    
    
    Label lblfilename1 = (Label)this.dtviewsimpledata.FindItemControl("lblfilename", dtviewsimpledata.VisibleItems[0]);
    
    
    Sampling.ControlPanel.Despatch.Engine tmpwebcount = new Sampling.ControlPanel.Despatch.Engine();
    
    
    Int32 strwebcount = tmpwebcount.CountDespatchWeb(Session["webplaced"].ToString(), Convert.ToInt32(Session["proid"].ToString()), 
    
    
    lblfilename1.Text,
    
    
    Convert.ToDateTime(labeldateimported.Text.ToString()), Session["targetcode"].ToString());
    
    
    this.lblwebcount.Text = strwebcount.ToString();
    
    
    tmpwebcount = null;
    
    
    }
    
    
    catch { }
    
    
    }
    and here is my asp code
    
    
    
    Count:
    
    
    <asp:Label runat="server" ID="lblwebcount" Text="0" ForeColor="SlateGray"></asp:Label>
    
    
    <%--<asp:Button runat="server" ID="cmdgetwebcount1" Width="110px" Text="Display Count" Font-Size="10px" &#111;nclick="cmdgetwebcount_Click" ValidationGroup="valoptwebpro" />--%> 
    
    
    <ext:Button ID="cmdgetwebcount" runat="server" Text="Display Count" ValidationGroup="valoptwebpro">
    
    
    <AjaxEvents>
    
    
    <Click OnEvent="cmdgetwebcount_Click"><EventMask ShowMask="true" Msg="Counting..." MinDelay="500" /></Click>
    
    
    </AjaxEvents>
    
    
    </ext:Button>
    Thanks,
    Kamal
  4. #4

    RE: Button ajaxevent

    Hi Kamal,

    I think the problem is you need to use AjaxEventArgs rather than EventArgs.


    Example


    protected void cmdgetwebcount_Click(object sender, AjaxEventArgs e)

    Hope this helps.


    Geoffrey McGill
    Founder
  5. #5

    RE: Button ajaxevent

    Thanks for prompt reply. I have tried it with protected void cmdgetwebcount_Click(object sender, AjaxEventArgs e) and no luck! It confuses me!!!</PRE>
  6. #6

    RE: Button ajaxevent

    Hi Kamal,

    I just noticed you are using an <asp:Label> control. If you switch to an <ext:Label> control, your code sample should work.


    Hope this helps.


    Geoffrey McGill
    Founder
  7. #7

    RE: Button ajaxevent

    Great. Thank you so much for your prompt reply and solution! Great work!

Similar Threads

  1. Replies: 1
    Last Post: Jul 24, 2009, 2:52 AM
  2. [V0.7] Error with Button and AjaxEvent
    By louis in forum 1.x Help
    Replies: 3
    Last Post: Apr 23, 2009, 6:55 AM
  3. Add ext:Button in AjaxEvent
    By Jurke in forum 1.x Help
    Replies: 5
    Last Post: Jan 16, 2009, 7:54 PM
  4. Button Click AjaxEvent
    By davidhoyt in forum 1.x Help
    Replies: 1
    Last Post: Nov 12, 2008, 1:35 AM
  5. [CLOSED] Button AjaxEvent in Usercontrol
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Sep 19, 2008, 7:39 AM

Posting Permissions