2017-04-22 76 views
0

我在頁面上有一個asp.net按鈕 點擊按鈕似乎沒有得到代碼 我試着將原因驗證設置爲false,沒有快樂 我已經在代碼背後設置了一個斷點,但它永遠不會到達那裏。 這實際上是工作時,我初步設置按鈕不知道爲什麼現在停止。 我進一步使用更新面板了網頁以及但是它的這個按鈕的內容外asp.net button not working or firing no postback

在嘗試點擊它時,看起來像回傳犯規甚至可以發起

   <asp:Button ID="btnRadioStatus" 
        runat="server" 
        OnClick="btnRadioStatus_Click" 
        Text="Online Radio Status" 
        Font-Size="Large" 
        Width="40%" 
        Height="300px" CausesValidation="false" 
        /> 

代碼背後,是

protected void btnRadioStatus_Click(object sender, EventArgs e) 
     { 
      using (var client = new SshClient("172.16.0.54", "test", "test")) 
      { 
       client.Connect(); 
       client.Disconnect(); 

      } 
     } 

沒什麼在頁面加載除了一些檢查

protected void Page_Load(object sender, EventArgs e) 
     { 



      //check for daylight saving time 
      dayLightSavingCheckAdjust(); 

      ReadMyData(); 



      System.IO.DirectoryInfo dir = null; 
      // Dim files() As System.IO.FileInfo 'array of fileinfo objects 


      //get the specified directory 
      dir = new System.IO.DirectoryInfo("Images\\hadiths"); 


      string[] files = Directory.GetFiles(Server.MapPath("Images/hadiths/")); 



      foreach (string str in files) 
      { 

       ClientScript.RegisterArrayDeclaration("imgfileName", "'" + Path.GetFileName(str) + "'"); 

      } 
      checkRadioStatus(); //check is radio is online 

     } 

的checkRadioStatus只檢查麥克風和更改文本和backcolour

public void checkRadioStatus() 
     { 

      using (var client = new SshClient("172.16.0.54", "test", "test")) 
      { 
       client.Connect(); 
       SshCommand strMicStatus = client.RunCommand(@"sudo amixer -c1 get Mic | grep Mono: | awk '{print $6}' | sed 's/\[//g;s/\]//g'"); 

       // Console.WriteLine(strMicStatus); 

       client.Disconnect(); 

       if (strMicStatus.Result == "on\n") 
       { 
        btnRadioStatus.Text = "Radio is Online"; 
        btnRadioStatus.BackColor = System.Drawing.Color.Red; 
       } 

       else 
       { 
        btnRadioStatus.Text = "Radio is Offline"; 
        btnRadioStatus.BackColor = System.Drawing.Color.Olive; 
       } 
      } 


     } 
+1

工作正常網頁中的其他按鈕/控件? –

+1

另外,你爲什麼認爲你的按鈕不工作?在事件執行過程中,您是否嘗試過調試或向客戶端發送消息? –

+2

你是否看到任何控制檯錯誤? – Boney

回答

0

解決了我的DIV + CSS過的Z-索引 - 1