|
I've been banging my head against what should be an incredibly trivial action -- popping up a "Please wait" dialog (with or without a progress indicator) while a long-running process happens from a System.Web.UI.Page object.
The basic launch is from a button handler routine in my code-behind:
Protected Sub GoBtn_Click(sender As Object, e As EventArgs)
OpenPopup()
DoMenuGeneration()
GenerateStatusDivVisible = False
ClosePopup()
End Sub
DoMenuGeneration() is the long task, it launches an external application (twice even) and blocks until the process is complete.
OpenPopUp() and ClosePopup() have taken many forms, the most promising were AjaxToolkit-based functions fired by javascript using ScriptManager.RegisterStartupScript, but while those popups *can* be made to auto-magically pop up based on a client-side button on the page being clicked, I cannot mimic that click through the ScriptManager. I either get an error (cannot find the control) or simply nothing happens as the code line is executed.
The first attempts were the most simplistic, the "pop-up" is just a named DIV tag with runat=server, and I manipulate the Visible property. As far as I can tell, the page simply doesn't render in between, so making the DIV visible has zero effect.
I've tried at least three different "solutions" given on the web ... so far none have even come close to working properly. I have tried:
So far ... nothing has worked.
Thanks in advance!!
|
|
|
|
|
Consider what is happening:
- You click the button;
- The browser posts the form to the server, and waits for a response;
- The code behind, which runs on the server, receives the request, and:
- Registers a startup script to display the dialog;
- Runs the lengthy process;
- Registers a startup script to close the dialog;
- Renders the response and sends it back to the browser;
- The browser receives the response and replaces the document.
- The browser executes the two startup scripts, displaying and immediately closing the dialog.
What you want to happen:
- You click the button;
- A Javascript method displays the dialog;
- The browser posts the form to the server and waits for a response - preferably using an AJAX request or an UpdatePanel;
- The code behind, which runs on the server, receives the request, and runs the lengthy process;
- The browser receives the response and updates the document;
- A Javascript method closes the dialog.
3 Different Ways to Display Progress in an ASP.NET AJAX Application | DotNetCurry[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
or not as expected.
if you look at this site[^] (dutch website)
I would like to have the tab content (made in JQuery) with a margin of around 25 pixels on either side (left and right) of the page, regardless of the content. (so it moves with the size of the browser).
For now, I did a dirty fix by setting the min-width to a certain amount of pixels, which is not what I want, but otherwise the width would adapt to the content of the tab. For the tab "programma" eg. only half the width of the page would be filled, the rest is the background image.
No matter what I did in the css, nothing worked. (although it looks trivial)
So what do I need to do to
* remove the fixed pixel width
* make the tab content as wide as the page (with a small offset of say 25 pixels left and right.
It COULD be the JQuery css that's messing things up, but I'm not a css/jquery wiz unfortunately.
the short HTML:
<body>
<div id="divparent"><br />
<div class="header"> title, social media stuff, ... </div>
<div class="main">
<div id="tabs">
<ul>
<li><a href="#tab-home">home</a></li>
<li><a href="#tab-club">club</a></li>
<li><a href="#tab-programma">programma</a></li>
<li><a href="#tab-inschrijvingen">inschrijvingen</a></li>
<li><a href="#tab-gedragscode">gedragscode</a></li>
<li><a href="#tab-info">informatie</a></li>
<li><a href="#tab-kalender">kalender</a></li>
<li><a href="#tab-faq">FAQ</a></li>
<li><a href="#tab-contact">contact</a></li>
</ul>
<div class="tabcontent"><!--</div>
</div>
</div>
<div class="footer">footer contents</div>
</div>
</body>
the css:
div.header { display: inline-block; }
div.main { margin: 0px 0px 0px 0px; }
div.tabcontent { margin: 0px 0px 0px 0px;min-width:1200px; }
div.footer { text-align:center;font-size:small;border-top:1px solid #F0F0F0;background-color:#1E1E1E;}
div#divparent { margin: 25px 25px 25px 25px; }
div#tabs { }
many thanks for your help !
modified 11-Mar-19 9:10am.
|
|
|
|
|
You have position:absolute; on the <body> element. If you remove that (and the min-width hack), the tab fills the width of the screen.
If you genuinely need the body to be absolutely positioned, you'll need to force the body width by adding min-width: calc(100vw - 26px); to it. But that's slightly hacky, since 100vw includes the width of the vertical scroll-bar, and there's no simple way to account for it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
body was indeed working in the back of my mind, though I was convincing myself the div would override the body.
The background was moving, but I fixed that with adding background-attachment: fixed; and the site looks far better now!
thanks!
|
|
|
|
|
My question is a little vague and not simple but I will try to be as concise as possible.
1. I want to create a new website from scratch.
2. I am a professional developer but have limited web experience.
3. I have extensive C# experience and my small amount of web experience has been on ASP.NET WebForms. For this reason, I would like to stick with Microsoft technologies.
4. It is almost 100% likely I will be the only person working on the site.
5. Initially the site will be no more than 10-20 pages and can probably be static HTML/CSS.
6. Even if the site becomes successful, still it is unlikely to get any tougher than maybe being able to query a back-end database, maybe have a login facility, maybe host a blog, maybe a shopping cart. But even if all of this does one day happen, the visitor numbers are likely to be tens-per-day.
I would like to move away from Web Forms because it seems to be too complex for my needs and because of this I find I never update the site.
I was thinking of recreating the site initially as static HTML/CSS but I like the idea of being able to add small chunks of Razor code here and there, to keep my options open if I need to add something I can't do in HTML.
So I was wondering if I can do this. Can I use Visual Studio to create a simple HTML/CSS web site that allows me to add bits of Razor code if needed? If I can do this, presumably I could later progress onto a more formal MVC architecture if I felt it was needed?
And one final part to this question: should I be looking at vanilla Razor or would I be better looking into Blazor?
Any help or advice would be very gratefully received.
Kind wishes ~ Patrick
Thank you to anyone taking the time to read my posts.
|
|
|
|
|
Are you looking for Razor Pages[^]?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for the reply, Richard.
I have visited the page you linked in my many travels on the subject but I quickly became unclear about how Razor could in any way stand alone from MVC. Having looked again at the page, I note that there is a separate link for Razor using MVC so I guess that implies what I am looking for is also contained somewhere in that section of MSDN.
I'll do more research. I was just hoping to get a few informed comments about my general approach since I don't have too much free time to spend on this and ideally don't want to waste what time I do have wandering down a blind alley.
Thanks again for your reply.
- Patrick
Thank you to anyone taking the time to read my posts.
|
|
|
|
|
Razor is a view engine, just as ASPX is a view engine.
The main difference between the two is that ASPX was developed based on the web-forms page model and was adapted for use with MVC.
Razor, on the other hand; was built atop the MVC page model and there has been no official adaptation to any other page modeling.
There was a Codeplex project for Razor, now on GIT; and a couple years old:
GitHub - Antaris/RazorEngine: Open source templating engine based on Microsoft's Razor parsing engine
There is also a 2-part blog set about how it's put together
Dissecting Razor, part 1: Parts of the framework – SLaks.Blog
With your personal website, I would probably just build an empty MVC project and just fill the Views with your static HTML. Not the most efficient way to do it, however; you will have the framework present to start learning Razor and MVC.
As for Blazor, it still is a little young and I don't see too much going on with it to build/promote this.
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
That's very helpful! Thank you!
I'll take some time to digest what you've written and I'm sure I'll be better informed to decide upon a way forward.
- Patrick
Thank you to anyone taking the time to read my posts.
|
|
|
|
|
Hi All,
I am little (a lot in fact) hazy on ASP.NET authentication methods...
At any rate I am trying to diagnose the following problem on an existing web app that use OpenID to query our ADFS server to authenticate users.
We followed that process:
https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/configuring-alternate-login-id
And the AlternateLoginID is a custom LDAP attribute (namely interactUsername )
With some custom C# code I created a an AD user with the following properties:
UPNLogon: IU-3762@licensys.com
SAMAccountName: dev\IU-3762
interactUsername: llandersxA
when I try to login with llandersxA on the ADFS login page, it tells me:
Incorrect user ID or password. Type the correct user ID and password, and try again.
And replace the user name I entered (llandersxA ) with dev\llandersxA before trying again (which is not recognised either)
Any idea on what I might be missing? or link that could help on that topic?
Cheers!
[EDIT] the plot thickens!
If the interactUsername looks like an email, say llanderxA@foo.bar it works!
modified 4-Mar-19 22:33pm.
|
|
|
|
|
When developing (a relatively simple) web page, what is the best way to add a menu to it. I noticed that the HTML tag <menu> has been depreciated. I also see that it has been brought back in HTML 5.0 so I am a bit confused. Please comment. Also could somebody point me to a good tutorial on menus in HTML?
Thanks,
Bob
|
|
|
|
|
You may want to consider looking a Bootstrap for developing web pages.
A good reference site is: W3schools.com
|
|
|
|
|
jQuery has a nice and easy menu.
Look in the jQuery UI.
It helps if you have knowledge of javascript and css. (before you download the library, you can define your own custom stylesheet attached to it)
of course there are other libraries or you can download pure html/css examples.
|
|
|
|
|
If you're asking what is the easiest way to implement then consider comments above. Although there is a belief that it's not necessary to load a huge CSS framework or JS library for such a simple task (keep in mind that not all users access your site from a laptop or via good internet, so huge CSS/JS libraries may cause unresponsiveness for quite a long amount of time which will negatively affect UX).
If you're asking instead what is the most appropriate HTML tag - consider nav
Although you can really get away without it, the whole HTML5 thing is about tags that have some semantics behind them, showing what the part of a markup really does.
|
|
|
|
|
I'm using a WebAPI in my app. When I run it, the browser opens. When I stop the app, the browser closes...
...at least it USED to. Now the browser stays open.
I have no idea what changed. Anyone know what this is?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I have datalist with imageButton generated from folder with Images. I am trying to change border on clientClick event to indicate that user selected that image. I was able to get click event for image but how to I unselect others images?
function ccSelectedImage(e) {
{
alert(e);
e.style.border = "1px solid Red";
return false;
}
}
<asp:datalist id="dtlist" runat="server" repeatcolumns="20" cellpadding="1">
<itemtemplate>
<asp:imagebutton id="Image1" runat="server" bordercolor="White" onclientclick="ccSelectedImage(this); return false;"
="" imageurl="<%# Bind("Name", "~/Images/{0}") %>">
Dim dir As DirectoryInfo = New DirectoryInfo(MapPath("Images"))
Dim files As FileInfo() = dir.GetFiles()
Dim listItems As ArrayList = New ArrayList()
For Each info As FileInfo In files
listItems.Add(info)
Next
dtlist.DataSource = listItems
dtlist.DataBind()
|
|
|
|
|
I have a controller called Operator. In it I have these two methods:
[HttpGet]
public Response<IEnumerable<OperatorEntity>> GetAllOperators()
{
return GetBL().GetAll();
}
[HttpGet]
public Response<OperatorEntity> GetOperator(Guid id)
{
return GetBL().Get(id);
}
In my WPF app I call this:
Response<List<OperatorEntity>> getAllOpsResponse = await _operatorWebAPIProxy.GetAllOperatorsAsync();
Note that I'm calling GetAllOperatorsAsync
The call fails with the message
The request is invalid.The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Guid' for method 'RemoteServices.Shared.Classes.Response`1[RemoteServices.Shared.Entities.OperatorEntity] GetOperator(System.Guid)' in 'RemoteServices.ServicesWebAPI.Controllers.OperatorController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
The message is saying that it's trying to reach GetOperator, not GetAllOperatorsAsync.
The URL I'm passing is http://localhost:53122/api/Operator/GetAllOperators/
This was working yesterday. This morning, the only change was me removing and re-adding the web API project. I copied the controller classess out, removed the Web API Project, re-added it and the two controllers, and this started.
Anyone know what's going on?
[UPDATE]
I have multiple GET methods in my controller. Fix is here.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
modified 1-Mar-19 14:17pm.
|
|
|
|
|
Sample Web Application with Login Form . On User log in capture the Ip Address , Host Name and store in database.
|
|
|
|
|
... and your question is?
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Every other framework will have its own services and components. In some frameworks (most modern frameworks, like Node.js, ASP.NET Core) you might be able to capture it automatically inside the request object. In other frameworks, you might have to add some other third-party libraries.
As far as the database component is concerned, you will need to check the runtime and its services for database. Again, all this depends highly on the runtime and framework.
If you don't know the runtime or framework, or have not yet chosen any, then a Google query can yield several results with this project sample, open sourced somewhere. Good luck.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
So there I was, writing some MVC code, when I installed jquery-ui through nuget.
I added the .min.js file to my startup bundles, and ran the app. I go the error
t.widget is not a function.
After making double-damn sure I had specified the correct path and spelled the filename correctly, I decided to see if the non .min file would work, and waddaya know - it did!
Does anyone know what's going on with this? At first, I figured it might be banging heads with jquery, but jquery would have been updated by nuget if it was necessary.
If I remember correctly, I'm using jquery-ui 1.12.1, if that matters.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
modified 25-Feb-19 7:35am.
|
|
|
|
|
This one?
NuGet Gallery | jQuery.UI.Combined 1.12.1[^]
I can't see anything obviously wrong with it. Did you definitely include the main jQuery library (v1.7 or later) first?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Nuget will update dependancies (I was already using 1.9), but why would the non-minified version work if that was the problem.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
OK, how are you defining the bundle? I've just tried:
bundles.Add(new ScriptBundle("~/bundles/jquery-ui").Include(
"~/Scripts/jquery-ui-{version}.min.js")); and it doesn't include the jQuery UI script in the rendered output, which would mean jQuery.widget wouldn't be defined.
Explicitly specifying the version number works:
bundles.Add(new ScriptBundle("~/bundles/jquery-ui").Include(
"~/Scripts/jquery-ui-1.12.1.min.js"));
Otherwise, do you have a stack trace from the error? And have you tried clearing your browser's cache?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|