Click here to Skip to main content
15,508,758 members
Home / Discussions / C#
   

C#

 
SuggestionRe: Windows services Not starting with c# codes Pin
Richard Deeming8-Jul-14 2:40
mveRichard Deeming8-Jul-14 2:40 
QuestionSession Timeout Pin
Member 106416987-Jul-14 20:57
Member 106416987-Jul-14 20:57 
AnswerRe: Session Timeout Pin
Bernhard Hiller7-Jul-14 21:46
Bernhard Hiller7-Jul-14 21:46 
AnswerRe: Session Timeout Pin
Karen Mitchelle7-Jul-14 21:55
professionalKaren Mitchelle7-Jul-14 21:55 
GeneralRe: Session Timeout Pin
Richard MacCutchan7-Jul-14 23:22
mveRichard MacCutchan7-Jul-14 23:22 
AnswerRe: Session Timeout Pin
Richard MacCutchan7-Jul-14 23:23
mveRichard MacCutchan7-Jul-14 23:23 
SuggestionRe: Session Timeout Pin
ZurdoDev9-Jul-14 3:19
professionalZurdoDev9-Jul-14 3:19 
QuestionTexbox OnKeyPress event thru javascript executes a button click event Pin
bjay tiamsic7-Jul-14 16:37
bjay tiamsic7-Jul-14 16:37 
Hi.

I have an application consists of 2 textboxes, 2 buttons, a modalpopup extender.

Button1 and Textbox1 is in a modalpopupextender that is shown when a button is click (not shown here)

I added an OnKeyPress event on my textbox (Textbox1) on Page Load that will execute a javascript on client side code which calls a button (Button1) click event.]

C#
protected void Page_Load(object sender, EventArgs e)
    {       

               if (!Page.IsPostBack)
        {
            this.TextBox1.Attributes.Add("onKeyPress", "doClick('" + Button1.ClientID + "',event)");
        }
    }



This is the Javascript codes, this will call and execute the click event of Button1
JavaScript
function doClick(buttonName, e) {
           //the purpose of this function is to allow the enter key to
           //point to the correct button to click.
           var key;
           if (window.event)
               key = window.event.keyCode;     //IE
           else
               key = e.which;  //firefox
           if (key == 13) {

               var btn = document.getElementById(buttonName);
               if (btn != null) { //If we find the button click it
                   btn.click();
                   event.keyCode = 0
               }
           }
       };


This is the Button1 Click event
C#
 protected void Button1_Click(object sender, EventArgs e)
    {
        if (Textbox1.Text.ToString() == "ITDevt")
        {
            Button2.Visible = true;
            Textbox2.Visible = false;
Button2.Visible=true;
Button1.Visible=false;
            popup.Show();
        }
        else
        {
            popup.Hide();
            Textbox1.Text = "";
        }
    }



Assume that the modalpopupextender is shown, so I entered a text in Textbox1 and presses Enter key on keyboard (so the OnKeyPress event is rendered).
When I trace the Button1_Click event, the code block runs. But the popup (modalpopupextender) hides.

Can you help me show again the modalpopupextender and hide Button1 and Textbox1 then show Button2 and Textbox2?
AnswerRe: Texbox OnKeyPress event thru javascript executes a button click event Pin
Dave Kreskowiak7-Jul-14 18:46
mveDave Kreskowiak7-Jul-14 18:46 
QuestionAn MVC concern Pin
Neo101017-Jul-14 11:25
Neo101017-Jul-14 11:25 
QuestionRe: An MVC concern Pin
Richard Deeming7-Jul-14 12:33
mveRichard Deeming7-Jul-14 12:33 
AnswerRe: An MVC concern Pin
Neo101017-Jul-14 23:33
Neo101017-Jul-14 23:33 
AnswerRe: An MVC concern Pin
Richard MacCutchan7-Jul-14 23:21
mveRichard MacCutchan7-Jul-14 23:21 
QuestionHow to make Setup Project Pin
Amr Muhammed7-Jul-14 9:32
Amr Muhammed7-Jul-14 9:32 
AnswerRe: How to make Setup Project Pin
OriginalGriff7-Jul-14 9:58
mveOriginalGriff7-Jul-14 9:58 
GeneralRe: How to make Setup Project Pin
Amr Muhammed7-Jul-14 12:30
Amr Muhammed7-Jul-14 12:30 
GeneralRe: How to make Setup Project Pin
OriginalGriff7-Jul-14 23:25
mveOriginalGriff7-Jul-14 23:25 
SuggestionRe: How to make Setup Project Pin
Erik Rude14-Jul-14 6:03
Erik Rude14-Jul-14 6:03 
QuestionBuffered Stream & OpenRead Pin
computerpublic7-Jul-14 8:54
computerpublic7-Jul-14 8:54 
AnswerRe: Buffered Stream & OpenRead Pin
Kornfeld Eliyahu Peter7-Jul-14 9:05
professionalKornfeld Eliyahu Peter7-Jul-14 9:05 
GeneralMessage Closed Pin
7-Jul-14 9:13
computerpublic7-Jul-14 9:13 
GeneralRe: Buffered Stream & OpenRead Pin
Kornfeld Eliyahu Peter7-Jul-14 9:21
professionalKornfeld Eliyahu Peter7-Jul-14 9:21 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 9:24
computerpublic7-Jul-14 9:24 
AnswerRe: Buffered Stream & OpenRead Pin
Kornfeld Eliyahu Peter7-Jul-14 9:27
professionalKornfeld Eliyahu Peter7-Jul-14 9:27 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 9:34
computerpublic7-Jul-14 9:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.