Click here to Skip to main content
15,867,488 members
Home / Discussions / C#
   

C#

 
SuggestionRe: Windows services Not starting with c# codes Pin
Richard Deeming8-Jul-14 1:40
mveRichard Deeming8-Jul-14 1:40 
QuestionSession Timeout Pin
Member 106416987-Jul-14 19:57
Member 106416987-Jul-14 19:57 
AnswerRe: Session Timeout Pin
Bernhard Hiller7-Jul-14 20:46
Bernhard Hiller7-Jul-14 20:46 
AnswerRe: Session Timeout PinPopular
Karen Mitchelle7-Jul-14 20:55
professionalKaren Mitchelle7-Jul-14 20:55 
GeneralRe: Session Timeout Pin
Richard MacCutchan7-Jul-14 22:22
mveRichard MacCutchan7-Jul-14 22:22 
AnswerRe: Session Timeout Pin
Richard MacCutchan7-Jul-14 22:23
mveRichard MacCutchan7-Jul-14 22:23 
SuggestionRe: Session Timeout Pin
ZurdoDev9-Jul-14 2:19
professionalZurdoDev9-Jul-14 2:19 
QuestionTexbox OnKeyPress event thru javascript executes a button click event Pin
bjay tiamsic7-Jul-14 15:37
bjay tiamsic7-Jul-14 15: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 17:46
mveDave Kreskowiak7-Jul-14 17:46 
QuestionAn MVC concern Pin
Neo101017-Jul-14 10:25
Neo101017-Jul-14 10:25 
QuestionRe: An MVC concern Pin
Richard Deeming7-Jul-14 11:33
mveRichard Deeming7-Jul-14 11:33 
AnswerRe: An MVC concern Pin
Neo101017-Jul-14 22:33
Neo101017-Jul-14 22:33 
AnswerRe: An MVC concern Pin
Richard MacCutchan7-Jul-14 22:21
mveRichard MacCutchan7-Jul-14 22:21 
QuestionHow to make Setup Project Pin
Amr Muhammed7-Jul-14 8:32
Amr Muhammed7-Jul-14 8:32 
AnswerRe: How to make Setup Project Pin
OriginalGriff7-Jul-14 8:58
mveOriginalGriff7-Jul-14 8:58 
GeneralRe: How to make Setup Project Pin
Amr Muhammed7-Jul-14 11:30
Amr Muhammed7-Jul-14 11:30 
GeneralRe: How to make Setup Project Pin
OriginalGriff7-Jul-14 22:25
mveOriginalGriff7-Jul-14 22:25 
SuggestionRe: How to make Setup Project Pin
Erik Rude14-Jul-14 5:03
Erik Rude14-Jul-14 5:03 
QuestionBuffered Stream & OpenRead Pin
computerpublic7-Jul-14 7:54
computerpublic7-Jul-14 7:54 
AnswerRe: Buffered Stream & OpenRead Pin
Kornfeld Eliyahu Peter7-Jul-14 8:05
professionalKornfeld Eliyahu Peter7-Jul-14 8:05 
GeneralMessage Closed Pin
7-Jul-14 8:13
computerpublic7-Jul-14 8:13 
GeneralRe: Buffered Stream & OpenRead Pin
Kornfeld Eliyahu Peter7-Jul-14 8:21
professionalKornfeld Eliyahu Peter7-Jul-14 8:21 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 8:24
computerpublic7-Jul-14 8:24 
AnswerRe: Buffered Stream & OpenRead Pin
Kornfeld Eliyahu Peter7-Jul-14 8:27
professionalKornfeld Eliyahu Peter7-Jul-14 8:27 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 8:34
computerpublic7-Jul-14 8: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.