Set linkbutton left to right in .net?
Question
<tr>
<td align="right">
<div style="background-image: url(image/menustript.bmp); border-right: #ffffff 2px outset; border-top: #ffffff 2px outset; border-left: #ffffff 2px outset; border-bottom: #ffffff 2px outset;">
<asp:ImageButton ID="ibtn_home" runat="server" ImageUrl="~/image/homebutton.jpg" ImageAlign="Middle" OnClick="ibtn_home_Click" Height="21px"/>
<asp:ImageButton ID="ibtn_teacher" runat="server" ImageUrl="~/image/teacher.png" ImageAlign="Middle" width="90" OnClick="ibtn_teacher_Click"/>
<asp:ImageButton ID="ibtn_student" runat="server" ImageUrl="~/image/student.bmp" ImageAlign="Middle" OnClick="ibtn_student_Click" Height="21px"/>
<asp:ImageButton ID="ibtn_result" runat="server" ImageUrl="~/image/result.JPG" ImageAlign="Middle" OnClick="ibtn_result_Click" Height="21px"/>
<asp:ImageButton ID="ibtn_logoff" runat="server" ImageUrl="~/image/logout.bmp" ImageAlign="Middle" OnClick="ibtn_logoff_Click" height="21px"/>
</div>
</td>
</tr>
want to set like below
home | teacher | student | result | logout
but, when admin login all menu should be like above..
but when student or even on home page. menu should be like,below
home | student | result
and when teacher login then menu shoulb be like , below
home | student | result | logout
can anyone help me.. to set menu with css or without css.. but give me anything which is set menu like this.
Solution
Try this:
<style type="text/css">
.menuRow
{
background-image: url(image/menustript.bmp);
border-right: #ffffff 2px outset;
border-top: #ffffff 2px outset;
border-left: #ffffff 2px outset;
border-bottom: #ffffff 2px outset;
}
.leftItem
{
float: left; display: block; padding-left: 5px; padding-right: 5px;
}
</style>
<table>
<tr class="menuRow">
<td align="left">
<asp:imagebutton id="ibtn_home" runat="server" imageurl="~/image/homebutton.jpg"
imagealign="Middle" onclick="ibtn_home_Click" height="21px" class="leftItem" />
<asp:imagebutton id="ibtn_teacher" runat="server" imageurl="~/image/teacher.png"
imagealign="Middle" width="90" onclick="ibtn_teacher_Click" class="leftItem"/>
<asp:imagebutton id="ibtn_student" runat="server" imageurl="~/image/student.bmp"
imagealign="Middle" onclick="ibtn_student_Click" height="21px" class="leftItem"/>
<asp:imagebutton id="ibtn_result" runat="server" imageurl="~/image/result.JPG" imagealign="Middle"
onclick="ibtn_result_Click" height="21px" class="leftItem"/>
</td>
<td align="right">
<asp:imagebutton id="ibtn_logoff" runat="server" imageurl="~/image/logout.bmp" imagealign="Middle"
onclick="ibtn_logoff_Click" height="21px" />
</td>
</tr>
</table>
OTHER TIPS
This is not really ideal, but you need to add to your image button a property CssClass.
Then set the following style on the class defined:
float: left; display: block; padding-left: 5px; padding-right: 5px;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow