Im currently using a method that looks like the following code to add script and css files to the head of the Layout file.
[Code]....
My problem is that this is a static method meaning it persists the list of stylesheets and script files.
I need to do the same thing that this does but without keeping it persistant.
I need the lists to be remade on every request since they change from page to page what the look are on that specific page.
Is it possible to clear the lists on every request prior to adding the scripts that are needed or maybe after they have been rendered out?
Update:
The reason for not using a section, RenderPartial or RenderaActions is to prevent the same stylesheet or script file to be added more than once to the Layout file.
The site im building has a Layout_.cshtml with the basic layout. This in turn is used by a View that loops through a list of items and for each item a RenderAction is called that outputs the specific partial view for that item. These partial views sometimes need to add stylesheets and scripts.
As there can be needed to add many different scripts and stylesheets from different partial views a global list for styles and scripts were the only way i thought this could be done so there is a global place to check if a script is allready added to the collection or not and then render them all at once in the order they were added.
Update 2:
The real question is how to do the same kind of function (a global list) but without using a static Extension method.
I am learning MultiView control.Here are question:I added 5 views in the MultiView but all views are tight together. I can not drag and drop another control such as text boxes or labels into view area.
I have an MVC view that contains a number of partial views. These partial views are populated using partial requests so the controller for the view itself doesn't pass any data to them. Is it possible to reload the data in one of those partial views if an action was triggered in another? For example, one partial view has a jqGrid and I want to refresh the data in another partial view when a user selects a new row in this grid. Is there a code example for this scenario (in C#) that I can look at to see what am I doing wrong? I am using ajax calls to trigger a new request but non of the partial views are refreshed so I am not sure if the issue is with the routing, the controller,
I spent the better part of today hunting down an elusive error. I was getting a message saying that it couldn't find the Index view for the Home controller, and it gave a list of locations it searched, e.g., ~/Views/Home/Index.aspx. This was really confusing as the file definitely existing and was at ~/Views/Home/Index.aspx, the first place in the list of locations it searched for the view!
What I eventually discovered was that there was a file that did not get published when I used Visual Studio's "Publish" feature (this is on the "Build" menu). That file was Views/Home/Home.master, and (as you can probably guess) is the master file used by Views/Home/Index.aspx. Once I copied that file into place manually, it started working. But I am left wondering--why??? Why does this file not get published? It's a part of my project, I can see it in the solution explorer, and it's obviously a critical file that's necessary for the MVC app to run. It has the same permissions as every other file in my project. So why wouldn't it get copied? And how can I fix it so it does get copied?
Basically, when the page loads i set the div visibility to false. When i click the button, i want the code behind function to be called, and the div tag to be visible, true.
$('#Button2').click(function () { $('#edit').show(function () { }); }); <input type="submit" id="Button2" runat="server" value="Search" OnServerClick="Button1_Click" /> but when clicking the button, the page posts back, causing the div tag to be invisible all times. I can set the return false to the onlclick event of the button , but i need to call the function also.
The Div can be visible or invisible in IE, but not in FireFox, the main purpose is: when user typing text in a password textbox, if the CAP LOCK is one, show the div:
So I have a two radio buttons. If RadioButton1 is selected, I want Panel1 to be visible and Panel2 to be hidden. If RadioButton2 is selected, I want Panel2 to be visible and Panel1 to be hidden. Is there a way to do this without requiring a postback?
I have a gridview with some data and two hyperlinkfields.I want to make the first hyperlinkfield of the first row not visible and the second hyperlinkfield of the last row not visible.this what I did till now
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then[code]....
This will work only for the first hyperlinkfield.Omitting the comments will make the first hyperlinkfield not visible for all rows.
I have a web page where a div needs to be displayed under certain conditions. I'm using the following code to toggle the display and have verified that it works.
[Code]....
To call this javascript function, I'm using the following code in the code-behind for the page:
[Code]....
I traced the flow using the debugger. When the page load, txt_Cat_ID.Text = "2" correctly resolves to FALSE and the toggleOptionsDiv script is run with the 'hide' parameter. The page correctly hides the div.
When I click on the link that makes txt_CAT_ID.Text = "2" resolve to TRUE, the code executes the line where the toggleOptionsDiv script is run with the 'show' parameter. However, the div remains hidden.
The link that is clicked triggers an asynchronous post back and I'm not sure if that is the problem. How can I get the div to display on postback?
I have this itemtemplate for a gridview column that is pulling data from a SQL database. My Question is how would I perform a check to see if my field ActivityFile has a value (which means a file is in the db) and then display the LinkButton at which point I generate code to download the file (already done and works).
I have a main menu option of "Dashboard". Under this menu item I have 2 options: 1) Campaign Manager & 2) Negotiation Manager. Now, what is interesting is when I am in either the campaigns role OR the auto-negotiation role I see the Dashboard and BOTH sub-menu items. This is not the behavior I expected. I expect to only see both sub-menus when I am in the campaigns role AND auto-negotiation role. The OR scenario should give me the Dashboard menu item and one OR the other sub-item...Am I doing something wrong here or thinking a wrong way?
I can control the visibility of these columns at the server side by using this -
grdTest.Columns[n].Visible = false;
But, I have to control the visibility from the client side using javascript. I tried a lot but I was only able to access either the row object or any particular cell of the gridview.
First off - has any recent .NET / Windows Service Pack / Windows Update changed the behaviour around the Visibility of Panels / User Controls? An area of our site has all of a sudden stopped working. The most recent change that I made was a few weeks ago, I've backed out the change from my development environment, but the issue is still happening.
I'll explain what is happening. I have a couple of forms where the same behaviour is happening, but they follow the same pattern:
On the form there is let's say 2 ASP:Panel controls. In each of these there is a separate ASP:UserControl. When the User first visits the page, they are shown the first Panel and User Control. On this control they complete a couple of steps and click Next. This fires an event on the main page, which hides the first panel and shows the second panel, at least that is what is supposed to happen - and if I debug and step into the code this is what is happening as normal. Except on screen, the first panel is no longer being hidden, so it would appear clicking the Next button does nothing.
I'm at a loss as to what has happening - nothing has changed, and stepping through the code it's working correctly, but the screen is not reflecting what is happening in the code.
My next step is to create an isolated set of test pages to recreate the issue. Will attach when done and investigated, hopefully this will solve it
For a website I was asked to put a bunch of information inside a few different categories. The tabpanel seemed fitting for this, and the person I made it for approved of the simple and elegant sollution.
However, he now has a somewhat tricky request: he wants it so that when people print (javascript::print()), they would be able to see all the information entered in the different tabs. Normally I would solve a thing like this with a different print rules inside my css file. However, in this case, the javascript attached to the tabcontainer/tabpanels puts the visibility:hidden on the elements themselves, meaning whatever I may write inside the css would be ignored either way.
Is there any simple way of making it so that these tabs will be shown when printing? Preferably a sollution that doesn't require me to rewrite most of the tabcontainer/panel code or making my own control from scratch. I would think that this "should" be achievable through javascript, but I thought I'd check here for ideas before rushing into things.
I have a delete button in each row of GridView (component ASP.NET). I want some of the delete buttons to be invisible. The visibility of the delete button should depend on the data that are back the row.
GridView is backed by EntityDataSource. GridView displays entities called Category, one instance in each row. Entity Category has (besides others) also a field of type EntityCollection. Name of that field is Items. Basically I want to allow user to delete a row only if the Items field of backing Category entity is an empty collection.
similar topic to what i posted yesterday ttp://forums.asp.net/t/1580413.aspxBut what I'd like to do, is click a label, hide this label but enable another label (which has a color background) for this I have the following code - but ASP.NET doesn't like the 'click' handling function????Can someone please point me in the correct direction to acheieve this please?
I want to change controls visibility on c#, but nothing happens. The controls are in an AspxPopupControl and 3 of them are hidden in design time, 1 of them is visible. I use this code to visible them
I am using entity framework 4.0 to bind a database object to a DetailsView on an ascx control. Within the DetailsView, I have a number of asp:panels that I'd like to show/hide depending on what's happening in that person's visit.
So, the first time through the page I'm setting panelA.Visible=false in the FormView_OnLoad event, and all is well - that panel is not output in the HTML. It listens to what I'm asking here.
Once I click submit and postback, I am again checking what's going on and setting panelA.Visibe=false in both FormView_OnLoad and EntityData_OnUpdating. But this time, when the page comes up panelA is showing.
I find that I can only hide that panel after postback by setting visible=false in DetailsView_PreRender, or by binding visibility to a public variable.
I'm thinking perhaps in the life cycle the DetailsView is binding again way toward the end, and throws away my visibility settings, even though they're not bound. So to show/hide panels within the DetailsView on postback, will I always have to set visibility on DetailsView_PreRender or after?
Am I on the right track here, or is something else resetting me at the last second?
Why can I set visibility the first time through the page but not postback?