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;
}
}
}
工作正常网页中的其他按钮/控件? –
另外,你为什么认为你的按钮不工作?在事件执行过程中,您是否尝试过调试或向客户端发送消息? –
你是否看到任何控制台错误? – Boney