.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

Keeping a button pressed

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :WPF

hey everyone

I have a question about button behavior.

There is a left column with a stackpanel (vertical) and I've created a rectangle , changed some settings (what this guy did http://www.youtube.com/watch?v=6d6yWhWH4U4) .

Now I have the buttons and each behavior is ok, changed some colors in onmouseover and pressed.

I want to keep a button pressed once it has been clicked to view a panel. Kind of a tab control but the tabs are buttons.

Don't know if it makes sense or not, or if there is another way to get this done, I'm all ears.


Thanks in advance

kind regards




View Complete Post

More Related Resource Links

CustomValidator which button pressed


I am CustomValidator to vlidate some data.There are 3 static buttons and some dynamically creating buttons in that page.

I just need to check validation when I press the save button.For all other button click I do not want to call the validation.
How do I tell that in the Validation function?

<asp:CustomValidator ID="CustomValidator1" runat="server"
        ErrorMessage="CustomValidator" ControlToValidate="DropDownList1"
         ClientValidationFunction="MyCustomValidation" ></asp:CustomValidator>

 function MyCustomValidation(objSource, objArgs)

//Proceed if the control pressed is cmdSave button.

    var Specialty = document.getElementById("DropDownList1").options[document.getElementById("DropDownList1").selectedIndex].text;

    if (Specialty == "Select an option")
objArgs.IsValid = false;
objArgs.IsValid = true;


Selecting Datagrid Row when Right mouse button is Pressed.


How can i select the datagrid row when i click the right mouse button. I need to show the context menu in the datagrid but i am able to generate the context menu but selected row i not changing.

How can i solve this issue.


Saugat K.C.

how to detect enter button pressed in private void button_click()


Hi, I am currently doing a project which control an external software using visual studio 2005. There is a button in the form. after I press the button, an external software will be opened. I am able to control it using mouseclick and sendkeys method. however, I need also to detect the enter button pressed by the user. Is there any idea??

For example

private void button1_Click( object sender, EventArgse)


    if(enter button pressed by user)





what can I write in the If statement?? Or I need to put other command in order to detect the enter button pressed??





Disposing when hower AND CTRL is activated AND left mouse button is pressed ????


I want to let the user get rid of some designelements (PictureBoxes) on a form very fast.

This code can do it IF the user holds down the CTRL-key AND moves the mouse cursor over the designelements.

    private void signal_MouseHover(object sender, EventArgs e)
      Cursor.Current = Cursors.Hand;
      if (commonThings.ctrlActivated)

I have two problems witch I can't solve:

1) I want to secure wrong deleting of designelements by ALSO test that the LEFT-mouse key is pressed togather with CTRL (there is no "buttons" with the e !)

2) the Hover-event is a little delayed, so the deleting is in fact a little slow

How can this be done ?


Best regards KSor, Denmark

Why nothing happens when PasswordRecovery submit button pressed?

<asp:PasswordRecovery runat="server" id="passwordrecovery" BackColor="white" BorderColor="#CCCC99" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="1em" QuestionLabelText="Question: In what city were you born?" QuestionLabelStyle="z-index:25" cssclass="square" UserNameInstructionText="To receive your password, first enter your User Name :" SuccessPageUrl="success.aspx">
	<InstructionTextStyle Font-Italic="True" ForeColor="Black" />
		<table id="user" class="passwordrecovery" border="0" cellpadding="5" cellspacing="0" style="border-collapse:collapse;">
				<table border="0" cellpadding="16">
					<tr class="titlebar">
						<td align="center" colspan="2" class="titlespacing"></td>
						<td align="center" colspan="2" style="color:Black;font-style:italic;">
						To receive your password, first enter your User Name :</td>

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Maintain HTML Radio Button Selection Inside GridView After Postback

Long time ago I wrote an article about getting the value of the selected RadioButtons inside the GridView control. The code did not addresssed the postback issue which means that the selected radio button was cleared after the postback occurs.

A Simple and Extensible Radio Button Style GridView

The GridView is one of the significant controls in ASP.NET 2.0 and later versions. No doubt it reduces a lot of work time. However, customizing the GridView control is not an easy task. For example, it's hard to add a radio button column to the GridView. This article demonstrates the reason why a radio button column cannot act as normal and how to create a simple and extensible radio button GridView.

Editable Gridview with Textbox, CheckBox, Radio Button and DropDown List

This is an example of an editable gridview containing different ASP.NET controls. When user wants to edit values in gridview, she/he can use these controls to edit existing values in Gridview Edit Mode.

Using the Code

Radio Button Event

Here I have explained the events of radio button with javascript.
Let me explain the scenarion first,
We are having two radio button say radioobtn1 and radiobtn2. If I click on the button 1 then I need to show one DIVor FORM. same as when I click on radiobtn 2. I have given the code for the above scenarion.

Problem with Dynamic Button


Hi friends,

I am trying to make a page inspired from http://login.qlikview.com/help.aspx

here I have made a dropdownlist and on clicking I am able to dynamically add the textboxes and radio buttons using placeholders. My problem is I am not able to use a dynamic number of submit buttons. In the page (link above) I need to make the submit button available for two choices and invisible for one.  But the option dynamicbutton is not available alike dynamicTextboxes etc. What could I do? Is there any other way I could figure out to implement this.

Thanking you in advance,


replacing ok and cancel button of an alert message with YES an NO button in asp.net web application.


i want to replace ok and cancel button of an alert message with YES an NO button in asp.net web application.When a user will click yes the data will be saved in the database and if user clicks that will act as a reset button and do not save the data in database and the control will move with as usual to the redirect page.Any pointers will be highly appreciated.I am usin g C# language.

Run Button Behavior: Suggestion/Bug


Note: This could be a bug or considered as suggestion. I am not looking for solution.

1: I have ImageWatermark.cshtml open and currently in focus.

2: I have Photo1.jpg selected in left Files workspace.

3: Now if I Click "Run", instead of opening ImageWatermark.cshtml it trys to open Photo1.jpg and it fails.

So ideally I would expect the "open file (ImageWatermark.cshtml) to run rather than running the selection from Workspace.

Button specific code


I have 2 submit buttons on my page. Right now, the only way to run the code behind with razor is to to If(IsPost). Since I have 2 buttons, how would I destinguish between the two in post? Is there a way to request a button that sent a post request?  

Html Link Button


Hi All,

I would like to create a html link button(in aspx page) so that the page could not post back and some controls to display on clicking link button.

Can any one of you help me regarding this issue?

Let me know if you have any queries.



Change Button Text in Multi Language Website


Hi i developing multi language website

using Master pages

everything fine

Page_Load i set the Text property of Button Control from Resource file

like this

Button1.Text = GetLocalResourceObject("Button1")

then in the button click event i cnage the text of the Button control

Button1.Text = GetLocalResourceObject("Button1_new")

but the text doesn't change and no error messgae

what is the problem how to solve this


Can't read global resource in asp button


I have translated Text Ok in arabic and I have that placed in global Navig.resx file

<asp:Button ID

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