85
rated 0 times
[
90]
[
5]
/ answers: 1 / hits: 66547
/ 10 Years ago, fri, february 28, 2014, 12:00:00
I am working on asp.net web application.
In one Page I have two asp buttons.
I want to display them in one condition otherwise I don't want to display them.
So I'm trying to do the same like this. But Its not working.
I can't find the reason behind it. Please tell me where is the issue.
To Hide Buttons
if (!IsPostBack)
{
ButtonReplaceId.Style.Add(display, none);
ButtonAssociateRules.Style.Add(display, none);
}
To display buttons
protected void ApplyAssociation(object sender, EventArgs e)
{
//Some piece of code
if(a==0)
{
ButtonAssociateRules.Style.Add(display, block);
ButtonReplaceId.Style.Add(display, block);
}
}
aspx for buttons
<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>
aspx of button for OnClick event 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>
<div style=text-align: center>
<asp:Button ID=AssociationMerchant Text=Apply Association runat=server OnClick=ApplyAssociation
CssClass=search_button_in_vm_associate1 OnClientClick=return checkValidation() />
</div>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ContentTemplate>
</asp:UpdatePanel>
More From » c#