I have made an image as the Edit text button.
For some reason I can't click it. Am I missing something?
If I leave it as text it is fine.
<asp:EditCommandColumn EditText="<li class='fa fa-pencil-square-o' style='color:green;background-color:white;font-size:25px;'/>" CancelText ="Cancel" UpdateText="Update" ItemStyle-Width="60" />
UPDATE:
HTML Rendered
So apparently you can't encase the image in a <li>
I changed it to a <span> and it worked :)
<asp:EditCommandColumn EditText="<span aria-hidden='true' class='fa fa-pencil-square-o' style='color:green;background-color:white;font-size:25px;'/>" CancelText ="Cancel" UpdateText="Update" ItemStyle-Width="60" />
Related
I am using lightbox by Lokesh Dhakar for an image gallery. I want to be able to initiate the lightbox gallery by clicking a button.
<span style="cursor:pointer" onclick='parent.$.lightbox({href:".gallery"}); return false;'><img style="margin-left:60px;" src="/images/template/assets/view.png" alt="View Gallery" width="120" height="33" /> </span>
Something along these lines...but this does not work for me.
I have a html control like
<input id="Button1" type="button" value="button" />
<input id="Text1" type="text" />
<img alt="" src="" id="img1" />
i want to set its tooltip or tittle in codebehind .
I tried the following code but its not working
Button1.Attributes["tittle"] = "i am button";
Text1.Attributes["tittle"] = "i am text";
img1.Attributes["tittle"] = "i am image";
this is not working please help
Set runat="server" for each control:
<input id="Button1" runat="server" type="button" value="button" />
Then in CodeBehind in Page_Load use this:
Button1.Attributes.Add("title", "i am button");
You need to mark those elements as runat="server" so that the server knows about them. Otherwise, server-side code won't be aware that they exist.
Alternatively, you could add a blob of javascript to the response message body and have the JS set the attributes. That's silly and ugly, though.
I have following code in aspx page:
<div id="a" runat="server" style="display:block;">
abc
</div>
I am trying to show the div in code like this:
a.Visible = True
But this is not working. Can anyone suggest how to do this without using any scripting language?
A div with runat=server becomes a HtmlGenericControl on serverside. This has the Visible-property as every server-control. So you can hide it on serverside. But that means on clientside it won't get rendered at all.
If you instead want it to be rendered invisibly, add the Styledisplay:none:
a.Style.Add("display","none")
Then you can also switch the visibility on clientside.
Apart from that your tag is malformed, change
runat="server
to
runat="server"
You are missing doube quotes after runat Server. It should be like this..
<div id="a" runat="server" style="display:block;">
abc
</div>
Or in code Behind to hide the div
a.Style.Add("display","none")
in code Behind to show the div
a.Style.Add("display","block")
Try this:
a.Attributes.Add("style", "display:block;");
Mode details:
http://msdn.microsoft.com/en-us/library/7512d0d0(v=vs.71).aspx
http://msdn.microsoft.com/en-us/library/system.web.ui.control.visible.aspx
<div id="a" runat="server" style="visibility:hidden" >
</div>
you can try : hidden in code vb.net
a.Attributes("style") = "visibility:hidden"
you can try : visible
a.Attributes("style") = "visibility:visible"
thanx
a.Style.Add("display", "block")
for visible
a.Style.Add("display", "none")
for hide
I have a strange problem with the page I'm designing. I have a link like this:
<a id="asel1" runat="server" href="#"><img id="isel1" runat="server" src="/Images/selbar/1.jpg" /></a>
And when I view source on the resulting page I get this:
<img src="/Images/selbar/1.jpg" id="ctl00_ContentMainSection_CardsControl1_isel1" />
My goal was to programmatically insert a link if it was applicable to the page in question, and leave a href="#" if it wasn't (basically a blank anchor tag). However now it will take them to an actual link, which of course doesn't exist.
How can I make it stop doing this?
How are you inserting the link? I've just tried the following:
<a id="asel1" runat="server" href="#">
<img id="isel1" runat="server" src="/Images/selbar/1.jpg" />
</a>
If you do nothing in the code behind the link is rendered as:
<a href="#" id="ctl00_MainContent_asel1">
<img src="/Images/selbar/1.jpg" id="ctl00_MainContent_isel1" />
</a>
and if in the Page_Load you define the href:
protected void Page_Load(object sender, EventArgs e)
{
asel1.HRef = "../Cards";
}
it will render as:
<a href="../Cards" id="ctl00_MainContent_asel1">
<img src="/Images/selbar/1.jpg" id="ctl00_MainContent_isel1" />
</a>
which other the id mangling is the expected behavior.
I know this is an old question, but I too ran into the exact same problem. In my case the anchor tag was also inside an ASCX file (user control). I found that if I removed:
runat="server"
then the problem was fixed.
I would have replaced the href as following:
<a id="asel1" runat="server" onclick="return false;">
<img id="isel1" runat="server" src="/Images/selbar/1.jpg" />
</a>
You are inserting the link dynamically in asp c#, right?
you have to look there for the href and id.
in asp, Control.ClientID value is generated by concatenating the ID value of the control and the UniqueID value of its parent control. That explains how your id is changing.
According to this Each part of the generated ID property is separated by the ClientIDSeparator property value. The value always returns an underscore (_).
That is why you have id="ctl00_ContentMainSection_CardsControl1_asel1"
On an ImageButton using the AlternateText attribute renders an alt tag to the browser.
<asp:ImageButton ID="imagebuttonStuff" runat="server" OnClick="imagebuttonStuff_Click" AlternateText="Make Stuff Happen" ImageUrl="/images/icons/stuff.png" />
<input type="image" name="imagebuttonStuff" id="imagebuttonStuff" src="/images/icons/stuff.png" alt="Make Stuff Happen" />
How do I render a title tag?
ToolTip="this is the title"