I have a link button with image and label inside it. After postback, the image and label is not visible.
< asp:LinkButton ID="AddNewRunLinkButton" runat="server" CssClass="Navigationlocalnav"
OnClick="AddNewRunLinkButton_Click" >
< img id="Img1" src="../../Images/add_newIcon.gif" runat="server" alt="Add New Run" />
< asp:Label ID="addText" Text=" Add New Run" runat="server"></asp:Label>
< /asp:LinkButton>
This link button is used to import/export data. I have added an attribute on click of this link button(AddNewRunLinkButton) to display a progress bar using javascript - SetInterval function. If I remove this attribute, the image and label is getting displayed, otherwise only link button is getting displayed.
AddNewRunLinkButton.attributes.add("onclick","javascript:DisplayProgress()");
function DisplayProgress()
{
timeid = setInterval("addBlock",100)
}
function Addblock()
{
// Display a progress bar as follows - Increase the width of a div tag at this interval
}
Any help?
I would use Async call to show the progress bar as opposed to what you are doing here. Sometime when you attach both client side and server side events, the page rendering doesnt work as expected. In this case you are using a Javascript timer with SetInterval and I believe that is causing the lable to disappear.
Since your code examples doesn't give much to go on I'm posting something I think might be what you're trying to do.
Markup and Javascript:
Code-Behind:
This does not "hide" the image, for me atleast.
Remark:
Instead of adding the OnClick event in the code-behind you can add it directly in the markup since it is not dynamically created: