Adding style to a modal popup - c#

I have added a modal popup AJAX control to my website.
When a button is clicked it correctly appears but im running into trouble with the styling.
At the moment I have added a new style to my site master Site.css style sheet but it is not taking effect on the popup.
I have a separate style sheet called 'modalBackGround.css'
This is the css class:
body
{
background-color:#000000;
}
This is my modelpop AJAX control, note the ccs property:
<cc1:ModalPopupExtender ID="Button2_ModalPopupExtender" runat="server"
TargetControlID="Button2"
BackgroundCssClass="modalBackGround"
DropShadow="true"
OkControlID="btnOk"
CancelControlID="btnClose"
PopupControlID="Panel1" >
</cc1:ModalPopupExtender>
How do I correctly apply this style sheet to the background of the popup to solve the transparency issue?

Sorted this. Please note. To anyone who is basing their pages on a site master. You can declare multiple css style sheets through the use of the 'link' property within the 'head'. This will then allow you to use these styles on every page as it is declared on the master.

Related

How would I let 1 .aspx page use another .aspx page's code?

I have 2 aspx files in my project. The first.aspx page has some content on it and when I click on a button, it will launch a frame (second.aspx that only has code to show a calendar) on the same page.
Now once that calendar(second.aspx) loads on first.aspx, I want to click a link on the calendar that will .show() a hidden DIV on the first.aspx page.
How do I access code cross pages? In other words, how can I write some code in second.aspx that will affect first.aspx.
What you're asking for is not really possible. You're probably approaching it the wrong way. What you should do is turn your calendar page into a user control so that it can be used seamlessly in first.aspx.
Here is how to get started with user controls in asp.net:
After you turn it into a user control there are different approaches to getting access to the properties of the user control from your page. Here is one approach using the FindControl method.
Hope that helps.
The easiest solution would be to show and hide your div with jquery. Simple give your div a class like:
<div class="myCalendarDiv" style="display:none" />
And your Button should look like this:
<asp:Button id="myButton" OnClientClick="return ShowCalendar();" runat="server" />
<script type="text/javascript">
function ShowCalendar() {
$(".myCalendarDiv").show();
return false;
}
</script>
Another way would be instead of creating a seprate webpage for the calendar, as proposed you can use a jquery dialog, or make a usercontrol and embedd it on the same page.
(Posted on behalf of the OP).
So since I was dealing with an Iframe, I found out that you can target the parent window which would be first.aspx.
I used "window.parent.MYFUNCTION();" to call my JavaScript function on first.aspx and show the div.

UpdatePanel and modifying controls outside of the Panel

I have a control inside of an UpdatePanel. The UpdatePanel has an AsyncPostBack trigger associated with the inner control. This works just fine.
I have another control containing a SSRS ReportViewControl that I would like to conditionaly hide based on the results from the postback event of the UpdatePanel mentioned above.
The ReportViewerControl is not inside of an UpdatePanel and I would like to keep it this way. How can I hide the ReportViewerControl based on the postback event of an UpdatePanel inside of another control?
I am assuming that many problems would spring up if I place the ReportViewerControl inside of an UpdatePanel, anyone know for sure?
You could create a script inside you update panel content template and hide your control form javascript.
<script type="text/javascript">
Sys.Application.Add_load(MyFunctionThatHides);
</script
The ReportViewerControl is not inside of an UpdatePanel and I would
like to keep it this way.
I did a simple trick. I created a another Updatepanel and put a literal control side the update panel and this update panel code Is Above the "Control you want to hide"
something like this
<asp:UpdatePanel ID="UpdatePanel5" runat="server" UpdateMode="Always" >
<ContentTemplate>
<asp:Literal runat="server" ID="literal1"></asp:Literal>
</ContentTemplate>
</asp:UpdatePanel>
Then in Code behind I inject CSS
something like this
literalDvControl.Text = "<style> #YourControlID{ display:none;}</style>";
This seems to be working. Basically literal control is injecting style tag and browser is very quick to react.
but do read about this .
Using <style> tags in the <body> with other HTML
Hide the content through server side code but rather to use javascript (possibly injected by the server through a postback) as suggested by Machinegon.
Have a second UpdatePanel around the other content that you want to hide. (You can't make the current one bigger, but making a second shouldn't cause problems.) Have that second update panel set the same button as the trigger. (You can have a trigger that's outside of the update panel, you just can't update content outside of the update panel.) If the update is conditional (you only sometimes change the content when the button is clicked) then you can set the only trigger for the second panel to be a hidden button which you Click in code from the handler of the first button click.
You can use following code after processing the Async AJAX call on server and just before returning the response to client/browser
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowHideReportViewerJSScript", <JS code to show/hide reportviewer>, true);
I assume you have scriptmanager placed on the ASPX page

Set Active Tab for AJAX Tab Control

I have a website that uses the AJAX TabContainer and has several tab panels. Each tab panel consists of a customer user control with many controls on it. I need to be able to set the active tab whenever server-side button click event is executed. How would I go about accessing the TabContainer from the custom controls C# code behind?
My markup is structured like this:
<cc1:TabContainer ID="TabRoot" runat="server" Width="100%" CssClass="ajax__tab_yuitabview-theme" onActiveTabChanged="TabRoot_ActiveTabChanged"
OnClientActiveTabChanged="SetIndex" ActiveTabIndex="0" AutoPostBack="True">
<cc1:TabPanel ID="TabPatientRoot" runat="server" HeaderText="Patient">
<ContentTemplate>
<custom:Patient ID="PatientInfo" runat="server" Visible="False"></custom:Patient>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
It is necessary that the server side codes executes a SaveData function before the tab panel is changed because whenever the active tab changes it loads the information for the newly selected tab panel, thus losing any information that wasn't saved on the previous tab panel.
How can I accomplish executing the server side SaveData function, and then have access to TabRoot to change the active tab? Currently I was using a javascript function (in the OnClientClick for the save button) to set the active tab but it is being executed before the server-side SaveData function. This seems to be a problem for users in IE9, only.
try like this and refer this examples Ajax Control toolkit
TabRoot.ActiveTabIndex = 0; // set your active tab index to display.
Try setting ActiveIndex of tab inside your button postback event.

How to change the color of the HyperLink in ASP.NET

i am doing mini ERP project., in that i have 3 frames.
frame is used as Header where i have "Home" and "logout" image button
when i click "Home" the frame3 goes to Home page and when i click "Logout" button, all the frames disappears and main window of "Login" screen comes.
i have used "Home " and "Logout" button in image using Hyperlink control in ASP.NET
the problem is due to Hyperlink the button gets blue border around it.
i want to remove that border around the image button.
can any one knows how to remove that border
here my codes
<asp:HyperLink ID="HomeButtonlink"
BorderWidth="0px"
Font-Overline = "False"
ImageUrl="~/Images/Untitled-5.png"
runat="server"
Height="100%"
Target ="frame3"
NavigateUrl="~/About.aspx"
BorderStyle="None"></asp:HyperLink>
thanks in advances
A.S.Rajkumar.Rajguru
I would create a new css class for this instead:
<asp:HyperLink ID="HomeButtonlink" CssClass="linkbutton"
ImageUrl="~/Images/Untitled-5.png"
runat="server" Target="frame3" NavigateUrl="~/About.aspx"></asp:HyperLink>
and you can define your class like this:
a.linkbutton, a.linkbutton:visited, a.linkbutton img
{
border: none;
outline: none;
}
You gain very little by using the asp.net server control. You can do the same like this:
<a href="<%=ResolveUrl("~/about.aspx")%>" target="frame3" class="linkbutton">
<img src="<%=ResolveUrl("~/images/untitled-5.png") %>" />
</a>
The border around images that are links is part of the default HTML stylesheet.
To get rid of it for all images, add a simple bit of CSS to your page as follows:
img {border:none;}
This is a common thing to want to do, as very few people actually want the default behaviour these days. You may want to look into adding a 'reset' stylesheet to your site to get rid of all the unwanted default behaviours. It will also make your page work more consistently between different browers.
Here's a link to a related question to help you find out more: https://stackoverflow.com/questions/116754/best-css-reset
If for some reason you don't want to affect all the image links on your site, you could also do a more specific stylesheet for it since you've given it an ID:
#HomeButtonlink {border:none;}
You could also add a CSS class to the object, and then reference that in your stylesheet if you wanted to apply it to a group of buttons.
...but frankly, I'd just go with the full reset if I were you.

Ajax Content Loading(Processing) image or indicator

in part of my web page, I have couple of asp:image Thumbnails, onclick I use ajax modal popup extender to show the imgae in full size which are working fine, what I need to add is to have a processing image or indicator both in thumbnail and modal popup extender,
I also have ajax autocomplete that is working fine, I need to add some indicator or processing image to it as soon as user start typing a word.
any idea?
Thanks in advance
You can use an update progress control to display a progress template within your update panel. It displays the contents of the ProgressTemplate tag whenever a postback occurs:
<asp:UpdateProgress runat="server" id="UpdateProgress" AssociatedUpdatePanelID="SomePanel" >
<ProgressTemplate>
<img src="processing.gif" alt="Processing" />
</ProgressTemplate>
</asp:UpdateProgress>
Also, I've found Preloaders useful as a source of animated GIFs for this purpose.
Look at http://www.ajaxload.info/. There are a ton of images there. Once the user types in some letters, however many you need, then display the ajax loader gif next to the textbox.
Assuming that you want the loader/indicator within control, so, one way could be to subclass the PopupExtender control, add asp:UpdateProgress, and put a loader.img in there.

Categories

Resources