.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

One method but two different buttons

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
I have two different buttons on the same page in different div tags (Add button and Update button). They use the same method to populate a drop down list. I'm trying to figure out how to write one method to cover both buttons.

View Complete Post

More Related Resource Links

Disabling Buttons within C# method


I'm sure this problem is easily solved but it is driving me slight crazy at the moment.

I have a form that has multiple buttons on it, the buttons (when clicked) add information to a gridview. When a user clicks on one of these buttons I want to disable the other buttons on the form until the method of the button they clicked has finished.

Here is a snippet of the button code within the form:-

<asp:Button ID="ButtonStudentNumber" runat="server" Text="Add Student" onclick="ButtonAddStudent_Click"/>  

<asp:Button ID="ButtonAddFile" runat="server" Text="Add File" onclick="ButtonAddFile_Click" />

C# code:-

protected void ButtonAddStudent_Click(object sender, EventArgs e)

     //IN HERE: I have tried to access the other buttons directly:-

     ButtonStudentNumber.enabled = false;
     ButtonAddFile.enabled = false;

    //I've also tried accessing the buttons through sender object:-

     Button but = (Button)sender;
     but.Enabled = false;


Can anyone advise

Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

Gridview with Radio Buttons

As now, Radio buttons are HTML controls, I am not able to get it on server side. When user select any radio button and press submit, Control will not available at code behind, you can use "e.Item.FindControl" as it is not "runat='server'". I want ID "Primary Key" value for selected radio button. To achive this I took the help of Javascript. I wrote javascript function that sets the values of "Primary Key" in hidden field when user clicks on any radio button. Now when user clicks on Submit button, user can get selected value froim hidden field.

Sys.Net.WebServiceFailedException: The server method '' failed with the following error:



Let's say we have 2 time consuming functions, aaa and aaa1 inside a aspx page.

        public static string aaa(int i)
            return i.ToString();

        public static string aaa1(int i)
            return i.ToString();



        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        <span id="displayspan"></span>
        <br />
        <input type="button" value=

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo

Using CreateNewUserWizard SendingMail method to email me, not applicatnt.


I have staff area of my site I am protecting with forms authentication using c# and .Net 4.0. What I want to do is let the staff members register on the site but instead of the confermation email being sent to them I want it sent to me so I can go in and approve it. I have been trying to use the SendingMail method  but can not figure out how to get it to email me instead of the person that registered. I have searched around this site and find many topics on the SendingMail method but none seem to properly address my issue. Can anyone help me out?

statement cannot appear outside of a method body


hi all,

  i am posting my vb.net problem .plz tell me how to resolve this :-

Dim conn As String = ConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString
    'Dim mysqlconnection As New SqlConnection(conn)
    'If mysqlconnection.State=ConnectionState.closed Then mysqlconnection.Open();
    'Dim mySqlcommand As New SqlCommand("select CategoryId,CategoryName from Categories", mysqlconnection)
    'Dim mySqlDataAdapter As New SqlDataAdapter(mySqlcommand)
    'Dim mydataSet As New DataSet()

    'if mysqlconnection.State=ConnectionState.closed Then mysqlconnection.Open();

i m getting 5 errors in this code

declaration expected in mySqlDataAdapter.Fill method; Gridview1.DataSource=ds; Gridview1.DataBind();

Question in Get method in C#


I got a recent working code from client.I see errors in the get methods when i compile , below are some place where the error happens.Can any one help me out?


Error 2 'System.Environment.NewLine.get': cannot explicitly call operator or accessor C:\Documents and Settings\shankar\My Documents\Visual Studio 2008\Projects\DKCLwin\DKCLwin\LocalizationAdmin.cs 150 170 DKCLwin

Error 2 'System.Environment.NewLine.get': cannot explicitly call operator or accessor C:\Documents and Settings\shankar\My Documents\Visual Studio 2008\Projects\DKCLwin\DKCLwin\LocalizationAdmin.cs 150 170

.NET Matters: Restart Manager and Generic Method Compilation


This month Stephen Toub answers questions pertaining to the Windows Vista Restart Manager API and generic method compilation.

Stephen Toub

MSDN Magazine April 2007

Test Run: Determining .NET Assembly and Method References


Before you can test any software system effectively, you must understand the system under test. If the system includes the Microsoft® . NET Framework, understanding the system under test includes understanding its assembly and method dependencies.

James McCaffrey

MSDN Magazine March 2006

.NET Delegates: Making Asynchronous Method Calls in the .NET Environment


One of the many great features of the .NET Framework is that it has asynchronous infrastructure built in. In .NET you can call any method asynchronously by defining a delegate for the method and calling the delegate's asynchronous methods. This is beneficial to your application because when a synchronous call is made, the calling thread is blocked until the method completes whereas an asynchronous call is made on a different thread, and this allows the original thread to continue its work while the asynchronous call is in progress.This article explains delegates in .NET and how to use them to perform asynchronous calls, eliminating age-old threading problems.

Richard Grimes

MSDN Magazine August 2001

Windows 2000: Asynchronous Method Calls Eliminate the Wait for COM Clients and Servers


Windows 2000 is the first version of COM to support asynchronous method calls, which permit clients to make nonblocking calls to COM objects and objects to process incoming calls without blocking the calling threads. COM clients benefit from asynchronous method calls because they can continue working while waiting for outbound calls to return. Objects benefit because they can queue incoming calls and service them from a thread pool. Our SieveClient and SieveServer sample apps demonstrate how to create and use asynchronous clients and servers in COM-based distributed applications.

Jeff Prosise

MSDN Magazine April 2000

Buttons with Mouse-Over Behaviors - Redux

I recently posted some CSS and HTML snippets for a buttons collection I was using for a Menu style UI Scott Koon from www.LazyCoder.com posted a comment with a better way (thanks Scott). This way I don't have to set the CSS Class for each button. Just contain them in a div. Here is the [...] Read More......(read more)

GridView EmptyDataTemplate and FindControl Method


I have 2 textboxes, a dropdownlist and a button in the EmptyDataTemplate of a GridView control and when I click the button I want to get the text from the text boxes and DropDownList put it in the QueryString of a URL i redirect to, but I can't work out why the FindControl method cannot find the controls.  I am using the following code:

Dim ddlNumPpl As DropDownList = GridView1.FindControl("ddlNumPpl")

I get an "Object reference not set to an instance of an object" error though when I try to refer to the SelectedValue property of it though.  I would be very grateful if someone could let me know why the FindControl method can't find the control and what I should do to rectify it.

Many Thanks (in advance),


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