i have a panel in my asp.net website
And i am trying to add image in runtime like this
ASPX
<asp:Panel ID="pnl001" runat="server" Height="300px" Width="1174px" >
</asp:Panel>
Code behind
pnl001.BackImageUrl = "D:/mayur.jpeg"
please help. Thanks!
you can try this if you want to set background image of panel from codebehind
pnl001.BackImageUrl = #"D:/mayur.jpeg";
Related
In the below code i am trying to display image inside a panel.But my image cannot access the image from C directory and place inside panel.Pls any one me to solve the issue
docimg.ImageUrl = #"C:\Search\Seardoc\Documents\Desert.jpeg";
imgPnl.BackImageUrl = docimg.ImageUrl;
<asp:Panel ID="imgPnl" runat="server">
<asp:Image ID="docimg" runat="server" Width="100px" Height="100px" /></asp:Panel>
use file:/// before the image name
#"file:\\\C:\Search\Seardoc\Documents\Desert.jpeg";
Example
CSS background image URL failing to load
I need to prevent scrolling entire UserControl. Instead I need to fix TextBox and Button at top but scroll GridView. Now it's scrolling entire user control.
Put your Grid View inside an asp:panel like this and keep the rest out of it :
<asp:Panel ScrollBars="Vertical" runat="server" ID="pnlGrid">
<asp:GridView runat="server" ID="Grid1"></asp:GridView>
</asp:Panel>
Regards
and Seriously Guys give the users reason while down-voting
I'm using a CalendarExtender control with the help of <img> to populate a TextBox with a date. I am using this in EditItemTemplate of GridView. But when I click on the image, the calendar control is not poping up.
I have used this CalendarExtender control in four or five other places (in this project) also. Everywhere else it is working fine. I have compared the code from the well working version to this code. No difference at all.
I have written the code like below:
<EditItemTemplate>
<asp:TextBox ID="txtDateDelivered" runat="server"
Text='<%# Bind("DateDelivered","{0:dd/MM/yy}") %>'
CssClass="DateTextBoxInGridView" >
</asp:TextBox>
<asp:CalendarExtender ID="calexDateDelivered" runat="server"
Format="dd/MM/yy"
TargetControlID="txtDateDelivered"
PopupButtonID="calDateDelivered">
</asp:CalendarExtender>
<img src="Images/calendar.gif"
id="calDateDelivered"
alt="Calendar" />
</EditItemTemplate>
Can anybody please tell where could be the problem?
how many row do you have in grid? also probably you have more than one image with such id
The image tag which you have used is not a server control.
It is simple html control, this is the reason why the calender control does not reconise this image control..
Try using asp.net image button over here instead of .
It should work then.
cheers....
Rahul C.
I am using the ASP.NET AJAX Control Kit and I am having a problem using a collapsible panel in my code. I have the following code:
<table><tr>
<td class="bg">
<a class="bg" href="javascript:void(0);">
<asp:CheckBox runat="server" ID="chkSMSGrossRevenue" Text="Gross Revenue (Daily, Monthly, Yearly)" /></a>
<asp:Panel runat="server" ID="pnlSMSGrossRevenue" Height="0">
testing
</asp:Panel>
</td></tr></table>
<cc1:CollapsiblePanelExtender runat="server" ID="cpeSMSGrossRevenue" TargetControlID="pnlSMSGrossRevenue"
ExpandControlID="chkSMSGrossRevenue" CollapseControlID="chkSMSGrossRevenue">
</cc1:CollapsiblePanelExtender>
What I'm trying to do is expand my panel whenever there is a checkmark in my checkbox and collapse it when there is no checkmark. The problem is, I always see the work "test", which is in my panel...so I'm assuming its never collapsing. When I click the checkbox, it collapses, but then immediately re-expands again. Can anyone tell me what I'm doing wrong?
since you are opening the page with the box unchecked, set the property of the collapsible panel extender to start collapsed
Collapsed="true"
I figured out the issue. It has to do with my tag at the top of my page
Setting CollapsedSize="1" solves the error
I'm using AJAX.Net (3.5) inside a usercontrol.
The usercontrol contains an UpdatePanel, and inside the UpdatePanelthere is a MultiView.
The ScriptManager is included in the page that act as container for the usercontrol.
To switch between views the usercontrol contains a simple button.
When I click it, the View is changed so the old content is hidden and new content is displayed.
My problem is that the content isn't hidden at all.
The view changes and the new content is displayed, but the old one remains on the page.
To isolate the problem, I tried changing the multiview and switching visibility of a simple label, but the behavior is the same.
Any ideas?
oh I understand. It's all right then. The problem is not of Ajax here. It's just you cannot embed something in <table> tags. In this case, you can try something different than the <table> control. Maybe a <div> or something else. I don't know exactly what sort of situation you have. Maybe you explain the result you want to achieve so I can give you some advice.
Regards
It seems that AJAX.Net doesn't work very well if you have part of a table outside the UpdatePanel.
On my control I want to show or hide some rows of a table. I included only the tr and td tags inside the updatepanel.
To reproduce the problem:
<table>
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<ContentTemplate>
<tr>
<td>
<asp:Label ID="lblToShow" runat="server" Text="Label to show" Visible="false" />
<br />
<asp:Label ID="lblToHide" runat="server" Text="Label to hide" />
</td>
</tr>
</ContentTemplate>
</asp:UpdatePanel>
</table>
If you change the visibility using:
lblToShow.Visible = true;
lblToHide.Visible = false;
The text of both labels are shown on the page (lblToHide does not hide)
If you move the table tags inside the UpdatePanel everything works fine.
call
updatepanel.Update()
after you make the changes to your updatepanel
or try
updatepanel.Controls.Clear();