8 posts
  • Bought between 1 and 9 items
  • Has been a member for 1-2 years
inquisitive says

Hello,

Please let I know how to apply same css for more than one button on same page.

I have one button as follows which is working fine for single button:

<input id=”consubmit” type=”submit” name=”consubmit” value=”Sign In” onclick=”javascript:TestCodeBehind2()” />

Introducing another button on page like below :

<input id=”consubmit1” causesvalidation=”false” type=”submit” name=”consubmit1” value=”Cancel” onclick=”javascript:TestCodeBehind3()” />

If we change name and id for the button then that css not working properly.

Please let me know how to solve this issue.

Thanks

5 posts
  • Bought between 1 and 9 items
  • Elite Author
  • Envato Studio (Microlancer) Beta Tester
  • Europe
  • Exclusive Author
  • Has been a member for 2-3 years
  • Referred between 50 and 99 users
  • Sold between 100 000 and 250 000 dollars
wellthemes says

I’m guessing that the CSS style is defined for the element with the id consubmit. So it will be applied to only those elements which have the same id. Since the second button has different id, thats why it is not being applied to that.

You can do that by two ways.

1. Use a common css class for the both buttons.

For example:
<input id="consubmit" class="button" type="submit" name="consubmit" value="Sign In" onclick="javascript:TestCodeBehind2()" /> 
<input id="onsubmit1" class="button" causesvalidation="false" type="submit" name="consubmit1" value="Cancel" onclick="javascript:TestCodeBehind3()" />
Now you can define the CSS for the button class.

2. If you don’t want to do that, you can copy the CSS code of #consubmit for #consubmit1.

Hope it helps.

8 posts
  • Bought between 1 and 9 items
  • Has been a member for 1-2 years
inquisitive says

It works when take up html input buttons. But the style does not get applied when we take a asp.net button control. For html input buttons, we do not have code behind like aspx page i.e. c# code. we cannot invoke the click event for which the code is written in c# file. So we need to make the style work for asp.net button control.

Please help.

308 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Portugal
DunKz says

Wellthemes is right,

Just need to put the style on .button { }

But make sure that don’t exist the same name already otherwise it will be replaced.

Regards

by
by
by
by
by
by