我正在研究asp.net Web应用程序.在一个页面中,我有两个asp按钮.我想在一个条件下显示它们,否则我不想显示它们.所以我试着像这样做.但它不起作用.我无法找到背后的原因.请告诉我问题在哪里.
隐藏按钮
if (!IsPostBack)
{
ButtonReplaceId.Style.Add("display", "none");
ButtonAssociateRules.Style.Add("display", "none");
}
Run Code Online (Sandbox Code Playgroud)
显示按钮
protected void ApplyAssociation(object sender, EventArgs e)
{
//Some piece of code
if(a==0)
{
ButtonAssociateRules.Style.Add("display", "block");
ButtonReplaceId.Style.Add("display", "block");
}
}
Run Code Online (Sandbox Code Playgroud)
aspx按钮
<div style ="padding-left:400px;">
<asp:Button ID="ButtonAssociateRules" runat="server" OnClick="AssociateMultipleRulesButtonClick"
CssClass="search_button_in_vm_intersection" Text="Associate Multiple Rules"
OnClientClick="return OnClientClickAssociateRewardRuleFile();" />
<asp:Button ID="ButtonReplaceId" runat="server" OnClick="ApplyReplaceIfRuleIntersects"
CssClass="search_button_in_vm_intersection" Text="Replace Previous Rules"
OnClientClick="return OnClientClickReplaceRewardRuleFile();" />
</div>
Run Code Online (Sandbox Code Playgroud)
用于OnClick事件的按钮的aspx ApplyAssociation()
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Table runat="server" CssClass="rule_file_whole" BorderWidth="0" Style="padding-top: 30px;">
<asp:TableRow ID="MerchantRowAssociation" HorizontalAlign="Center">
<asp:TableCell> …Run Code Online (Sandbox Code Playgroud) 我正在ASP.net中开发一个Web应用程序,它需要登录名和密码.
我想记录正在访问此Web应用程序的客户端的IP地址和计算机名称.
我正在使用log4net进行日志记录.
我尝试过这段代码,但是在使用IIS-7而不是客户机名称部署此Web应用程序后,我在日志中获得了Server Machine HostName.
Login Page Page_Load 方法:
protected void Page_Load(object sender, EventArgs e)
{
log4net.GlobalContext.Properties["Hostname"] = Dns.GetHostName();
}
Run Code Online (Sandbox Code Playgroud)
Web.Config更改:
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %property{Hostname} [%thread] %-5level %logger - %message%newline" />
</layout>
Run Code Online (Sandbox Code Playgroud)
这是一个非常庞大的项目,所以请建议我在Code中记录客户端IP地址和机器名的最小变化.
我正在使用以下命令,但它不起作用:
C:\ Program Files(x86)\ Microsoft Visual Studio 8\VC\bin> xsd/c/l:cs SubsystemReg.cs
让我们说这是我的班级:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace PaymentControllerGUI
{
public class EmptyClass
{
}
}
Run Code Online (Sandbox Code Playgroud)
而我正在尝试这个.
C:\ Program Files(x86)\ Microsoft Visual Studio 8\VC\bin> xsd/c/l:cs EmptyClass.cs
错误:
命令行参数无效:'SubsystemReg.cs'
我有一个GridView,我在javascript函数中有一个行索引.现在我想使用javascript在GridView中获取该索引的Column值.请告诉我怎么做?
我String在 a 中有金额TextBox,我想除以 100。
该值应四舍五入到两位小数。我试过了,但没有得到正确的值。
这是我尝试过的:
6766/100 = 67.66
47/100 = .47
98/100 = .98
Run Code Online (Sandbox Code Playgroud)