.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

Cannot call the button_Click event

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


I would really appreciate if someone can solve this below sample of code. (This is a solution for all those who want to know how to load  a usercontrol inside a popUp.)

The solution works perfectly except that, after the popup is loaded, when you hit Enter, I want to call the btn_ok (button click event) of the Child.ascx that should MessageBox(the event is fired..) but now it fails to call teh button_Click event.

Please find my whole code step by step below:


    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager5" runat="server">
              <asp:PlaceHolder ID="phlDefault" runat="server" />


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim UC As New UserControl
        UC = LoadControl("NewSearch.ascx")
    End Sub



<%@ Register Src="~/Popup.ascx" TagName="Child" TagPrefix="uc" %>

<uc:Child ID="uc_Child" runat="se

View Complete Post

More Related Resource Links

Gridview edit mode - What event does enter key call?

I have sort of a very specific problem.  I have a gridview with a few different template columns and a commandfield with the standard "edit" link.  There is no sqldatasource associated with it at all.  In the code, I pull some data from an sql database into a datatable and set the gridview's datasource to be the datatable.This all works fine.  When I hit the "edit" button, the standard textbox shows up where it needs to so that I can edit the data.  The problem is the updating portion.  I have programatically removed the "update" button and left the "cancel" button for design reasons. I want the user to be able to hit "enter" in order to update the data in the data table.  Then, when they're ready, they can click a submit button which will extract the data from the datatable and update the database.I'm having trouble with this 'enter key' business.  When you edit the data and hit "enter" while in edit mode, the page posts back, and the previous values are placed in the gridview.  What event was just  called?  I need a way to take what the user put in and place it in my datatable.  What are my options?Thank you. 

How to call a method with IDataObject in click event in wpf?

As I'm new in WPF development, I came up with a problem, looks like simple, however, I couldn't solve. The problem is, how to call a method with IDataObject in a click event?? I've a method like:  public void setProperty(IDataObject obj)         {                                      PropertyGrid mygrid = new PropertyGrid();                        UIElement elt = ExtractElement(obj);             Type t = elt.GetType();             string name = (string)t.GetProperty("Name").GetValue(elt, null);             mygrid.Instance = name;         } I want to call this method in a click event. I don't know how to. I've tried but couldn't yet. Any help will be appreciated regarding this. Thank you.   Regards, Binaya

call static event from non static procedure

Hai, I have a static event and i want to load this event from a non static procedure but it shows to add object reference , i use this code c#         public delegate void LoadListEventHandler();         public event LoadListEventHandler LoadList;         private static void LList()         {             LoadList();         } please tell me how can i call LoadList event thanks.

how to call a function or event using jquery Ajex

<asp:Button id="Bu_DocShareSave" runat="server" Text="Save Share" OnClick="Bu_DocShareSave_Click"/>protected void Bu_DocShareSave_Click (object sender, System.EventArgs e){            string S_DocShareID=CCUtility.ToSQL(Utility.GetParam("txt_DownloadFileID"),FieldTypes.Number);            string S_DocStorage=CCUtility.ToSQL(Utility.GetParam("dbo_Storage"),FieldTypes.Text);            string S_DocShareToEmp=Utility.GetParam("dbo_Emp");            string[] SA_DocShareToEmpSplit = S_DocShareToEmp.Split(',');                        int a=0;                         foreach (string Empid in SA_DocShareToEmpSplit){                        if(!Empid.Equals(""))                   {                      

asp:Button inside a SharePoint Dataview's Rows with onclick event does not call C# function. Pull i

asp:Button inside SharePoint Dataview Rows with onclick event does not call C# function. Pull it out of Dataview and works fine. I have a ASP.NET Button I've placed inside a SharePoint  DataView's rows with an onclick event pointing to C# function block inside my page. The page refreshes when I click on them, but it's not hitting that code block. If I move the button to outside the dataview and make the ID fixed, the code works beautifully. what's up with that? the button in the Dataview: td class="ms-vb" style="width: 70px"><asp:Button runat="server" Text="Delete" id="Delete{@ID}" CommandArgument="{@FileRef}" OnClick="DeleteDoc"/> </td> my C# onclick handler (inline C# on the page) void DeleteDoc(object sender, EventArgs e) { Button b = sender as Button; .. more code The buttons are rendered and they look like this: input type="submit" name="ctl00$PlaceHolderMain$g_08acadfd_957b_4112_a426_cc7c81991c1e$Delete1" value="Delete" id="ctl00_PlaceHolderMain_g_08acadfd_957b_4112_a426_cc7c81991c1e_Delete1" Thie code block in inline and I'm working from SharePoint Designer. Not sure how I can troubleshoot this.  Am I missing something here, maybe I need to add an Itemtemplate or something like we need to in the ASP.N

How to call java script in grid rowdatabound event

Guys I want some help on this issue my code goes like this protected void grdResults_RowDataBound(object sender, GridViewRowEventArgs e)    {        if (e.Row.RowType == DataControlRowType.DataRow)        {                       TextBox txtQty = e.Row.Cells[1].FindControl("txtQty") as TextBox;            Label lblTWeight = e.Row.Cells[9].FindControl("lblTWeight") as Label;            Label lblTMHRS = e.Row.Cells[10].FindControl("lblTMHRS") as Label;            Label lblTLabor = e.Row.Cells[11].FindControl("lblTLabor") as Label;            Label lblTMaterial = e.Row.Cells[12].FindControl("lblTMaterial") as Label;            Label lblTCost = e.Row.Cells[13].FindControl("lblTCost") as Label;            string onComp = "getTotalComplete(document.getElementById('" + txtQty.ClientID + "'));&q

how to call a event another page & refresh other page jquery

!) i have two page a with event   Bu_DocSearch_Click (object sender, System.EventArgs e)  i require it call another page and reftesh automatically protected void Bu_DocSearch_Click (object sender, System.EventArgs e){            //+" order by a.ID";            string sql="";            string S_SubjectContain=CCUtility.ToSQL((Utility.GetParam("txt_SubjectContain")+"%"),FieldTypes.Text);;            string Find=" and a.Subject Like "+S_SubjectContain;            //string Find=" and a.Subject ='"+S_SubjectContain+"%'";                                ArrayList SelectedChkBox =new ArrayList();                SelectedChkBox =Utility.CheckboxSelected(CheckBoxBind);                    string Inclause="";            for(int i=0;i<SelectedChkBox.Count;i++){ 

Open a new Window on Button_click event


Hello, I am learning Visual Studio 2008 on the fly.

I'd like to get a help on how to open a new window when the report is opened for view.


1. Populate the asp:DropDownList to fill PDF file names

2. Select the report and click asp:Button

3. Pop a new window to browse the PDF file.

1 and 2 are working fine but for #3 - the report shows up but I can't goback to Home page unless i kill the window and restart the App or use the back button on IE.

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim org = "C:\Documents and Settings\My Documents\PDF\"


FormView doesnt call itemupdating event?


Hello all,

So, to sum is up, I have a FormView:

        <asp:FormView ID="fvSubscriptionEdit" DefaultMode="Edit" runat="server" GridLines="None"
            CssClass="SubEditPanel" OnItemUpdating="fvSubscriptionEdit_ItemUpdating">
                    Abonnement wijzigen</h2>
                <asp:HiddenField runat="server" ID="hfSubscriptionId" Value='<%# Bind("SubscriptionId")%>' />
                <asp:Label runat="server">Type wijzigen</asp:Label>
                <asp:DropDownList ID="ddlTypeEdit" runat="server" SelectedValue='<%# Bind("SubscriptionType")%>'>
                    <asp:ListItem Text="- Kies -" Value="1" />
                    <asp:ListItem Text="Upgrade" Value="upgrade" />
                    <asp:ListItem Text="Verlengen" Value="verlengen" />
                <hr />
                    Credits wijzigen</h2>
                <asp:Label runat="server">Nieuw aantal credits</asp:Label>

How to call a button click event on from an event handler



I got an event handler like this, in this event, i wanted to call another button click event. How can I do that?

protected void gwDetail_SaveCommand(object sender, System.EventArgs e)
            lblMsg.Text = "Saving...";


if (ds.Tables[0].Rows.Count == 0)

how to call button click event of ascx page in the button click event of aspx page



i'm using user control in my page.i need to call the button click event of user control in the button click event of aspx page based on some condition.is it possible?can any one help me?

view state doubled if i call prerender event


i have one method which save datatable in viewstate.

i am calling this method in

1. page_load

2. Prerender

the page was every heavy,

i did tracing of page i found due to calling of method from preprnder it doubled the viewstate size

what was the reseon behind this.

i wrote an code in button_click event and i want to execute the same code when i click another butto


Hello all ,

i wrote an code in button_click event and i want to execute the same code when i click another button

how can i do that ?

Kareem Naguib

How to call Picuture box mouse up event in the Picture box paint event..


Hi, I have problem that whatever the graphics that i have drawn on the picture box in the Picture box mouse up evnet is not persist while i minimise or maximise the window. To solve this problem i came to know that i need to redraw everything on picture box paint event also.so i need to know that how to calll the picture box mouse up event in the picture box paint event..I don't know whether i am going in the right path or not to solve this above problem..Any help can be appreciated.. Here is my code in the Picture mouse up event...

private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
            blnDrawing = false;
            blnErasing = false;

              if (circle == 1 || text == 1 || ellipse == 1 || arrow == 1)

                    if (circle == 1)


How to call a javascript click event from ASPx?


this is kind of wierd but I need to use behindcode or aspx code to call a javascript click event.  The reason is because, I have two controls.  One control is a javascript controls tabs.  The other control is a panel.  The panel has a bunch of controls and depending on which tabs are being selected, the panel will switch to panel1,2,3,4 depending on if the user click tab1,2,3,4.

I've got the upper part programmed by using a __doPostback to the update panel.

However, in this case, I need to program the opposite because when the user switches the panel, the tab must be switched.

So here's what I got when a user clicks the tabs:

<a href="#" onclick="easytabs('1', '1');__doPostBack('UpdatePanel2', 'Tab1');return false;" onfocus="easytabs('1', '1');" title="" id="tablink1">

So I need a server side function such that when a user clicks <asp:LinkButton> or something, it will also call "easytabs('1','1');

How to track Collapse/ Expand event of AJAX Collapsible Panel Extender to call javascript ?



I am working with AJAX Panel Collapsable panel extender.

The Panel which is to be collapsed/Expanded using AJAX panel Extender contains one custom control, containing 3 Radio buttons one of them is set checked through a javascript function when page loads. I have kept the default property of AJAX collapsable panel as Collapsable.

Script for AJAX Collapsible Panel Extender is as follow. 

 <ajax:CollapsiblePanelExtender ID="cpeSOP" runat="Server" CollapseControlID="pnlCollapsable"
   CollapsedSize="0" Collapsed="True" CollapsedImage="~/public/img/arrowRightWhite.gif"
   ExpandControlID="pnlCollapsable" ExpandDirection="Vertical" ExpandedImage="~/public/img/arrowDownWhite.gif"
   ImageControlID="Image1" SuppressPostBack="true" TargetControlID="pnlSearchCriteria">

But problem is that when page loads, collapsible panel gets collapsed but it resets the radio buttons in custom control. i.e. First radio button does not get checked. Script for Collpsable panel is as follow. I want to call some javascript code when the panel is Collapsed or Expanded. Is there any way to track Coll

how to call dropdown SelectedIndexChanged event in page load event in c#


Hi everyone,

in my web form i have a department dropdown box, in its selectedIndexChanged event i have to fill the equipment dropdown box and in equiment dropdown selectedIndexChanged i have to fill out the other textboxs.

the depratment dropdown box get its value from sqldatasource.

 <asp:DropDownList ID="dp_deptname" runat="server" DataSourceID="SqlDataSource1" DataTe

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