|
I have encountered a problem of updating dock panels on client side ( browser ). After time interval elapses, I have to send callback to update the contents of dock panel.
Each and every dock panel can have own respective time interval that can be set/reset by the user by interacting it's settings module. Thus we can have something like
dock panel_a : update after 10s
dock panel_b : update after 5s
dock panel_c : update after 15s
...............................
later on user might can change all the timers and these module might update totally on different intervals. I might be ended up having 100's of dock panels and correspondingly 70's would update their contents and 30 might never update Or 30 would update and 70 would be set to Never update.
What would be right implementation??
Should I write complete server side functionality ( in this case, I would write delegates or complete asynchronous implementation for updating all modules available on client side )??
Should I maintain a list of available panels at client side and need to access that list for sending callback once the time interval elapse for specific dock panel? If so, I would definitely need a parent timer available on client browser window which would count the seconds and on completion of seconds, it will match and refer the previously maintain list. If so,
List might contain 50 panels corresponding 50 timer objects.. Would that be fine?
Note: I am more in a favour of implementing server side code ( delegates and asynchronous ) because my server side better knows how many dock panels rendered on screen and for each dock panel it can maintain thread to update dock panel on client side.
what should be the right way?
Regards
Usman
|
|
|
|
|
You could include SignalR in your application to push updates to currently connected users. Alternatively you could use JavaScript timers to pull updates. Considering that you'll need to write a bit of JS to coordinate where the updates are targeting, that would be my route.
You should just need 1 timer, though, and attach the panel updates as events to a periodic method. Multiple timers that all do the same thing is just a waste of resources.
|
|
|
|
|
I understand Views, but as my project gets bigger and to stay organized, I wanted to create views within views.
So If I have a view called Admin or
http://website.com/Admin
I wanted to create a folder under it
http://website.com/Admin/Management
So I googled around the interwebs, and I guess I can't get the nomenclature to find the answer.
I can't see having a huge backend in MVC and making a huge model and controller in Admin.
modified 6-Nov-15 15:17pm.
|
|
|
|
|
|
I was referring to the latter. But you gave me a nudge in the right direction. I'll look at the route config.
|
|
|
|
|
For a C# WPF position I got asked
"You have an MVC unit- How do you get around dependencies?"
I'm not looking for the answer.. I don't even understand the question.
What are they asking here?
Also, why would this have anything to do with WPF??
modified 3-Nov-15 13:30pm.
|
|
|
|
|
And why have you posted this in the ASP.NET forum?
|
|
|
|
|
Last time I checked, MVC is part of ASP.net.
|
|
|
|
|
|
zephaneas wrote: What are they asking here?
I don't understand either. Maybe they meant "unit test" rather than "unit"? Or maybe they meant you were re-using code from an MVC project in your WPF project. There is no harm is asking them to explain what they mean.
|
|
|
|
|
I want to do a parody album management ASP.NET application, you can upload pictures, display, preview.
Give me an idea seeking seniors and help
|
|
|
|
|
What have you tried?
Where are you stuck?
What help do you need?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I have not good idea for this function,I need a detailed plan.
|
|
|
|
|
You mean it's your homework and you don't know how to do it, or what?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Member 11883266 wrote: I need a detailed plan. That is called "Research, analysis and design", and is what you do before you start coding.
|
|
|
|
|
yes indeed ,I am very stupid,I don't want to use plugin to upload images,feeling very complex use plug-ins,I want to try do this use pure code,can you help me
|
|
|
|
|
Nobody is calling you stupid!
But...we do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
And working out what you need to do, and what you need to learn in order to do that is part of the task.
Try it yourself, you may find it is not as difficult as you think!
If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
That was a mouth full, I can't figure it out. This is my first Dropdownlist in MVC 5 and Razor
So I can get the Dropdownlist to load the values, but if the edit fails, the values don't persist. I'm sure I don't have to load it again in ActionResult with HttpPost.
I can't figure out how to set the value on edit or page load.
And I'm not sure if the value is picked on on postback, but I'll work on that part now.
So here's what I have now.
[Model]
[Required]
[Display(Name = "Security Level")]
public IEnumerable<System.Web.Mvc.SelectListItem> AdminSecurityLevels { get; set; }
public int SecurityLevel { get; set; }
[Controller]
public ActionResult UserEditor(int? userID)
{
IEnumerable<SelectListItem> securityLevels = SelectListHelper.GetAdminSecurityLevels();
ViewBag.AdminSecurityLevels = securityLevels;
}
[View]
<div class="form-group">
@Html.LabelFor(m => m.AdminSecurityLevels, new { @class = "control-label" })
@Html.DropDownListFor(m => m.AdminSecurityLevels, Model.AdminSecurityLevels, new { @class = "form-control" })
</div>
And a [Class]
public class SelectListHelper
{
public static IEnumerable<SelectListItem> GetAdminSecurityLevels()
{
IList<SelectListItem> items = new List<SelectListItem>
{
new SelectListItem{ Text = "Select admin security level", Value = "--"},
new SelectListItem{ Text = "5 - Super Administrator", Value = "5"},
new SelectListItem{ Text = "4 - Management", Value = "4"},
new SelectListItem{ Text = "3 - Website Operator", Value = "3"},
new SelectListItem{ Text = "2 - Field Employee", Value = "2"},
new SelectListItem{ Text = "1 - Demonstration", Value = "1"}
};
return items;
}
}
|
|
|
|
|
Well it works, but I'm sure over time I will figure out a more efficient way to do this.
I did complete this 2 hours after the first posts time stamp.
In the Model, I change the Security Level to a string, and just casted it from int to string and back in Linq for my Entity Framework.
[Required]
[Display(Name = "Security Level")]
public string SecurityLevel { get; set; }
public Dictionary<string, string> AdminSecurityLevels { get; set; }
[Edit] Persist across postbacks
In the Controller to make the values persist across postbacks, I found you do have to call the class function twice, once for ActionResult and once for ActionResult Post. So sa.AdminSecurityLevels is my Dictionary of Key Values.
sa.AdminSecurityLevels = SelectListHelper.GetAdminSecurityLevels();
In my Class, in App_Code, I made a helper that is called in the controller above.
I wanted to use IEnumerator, but could not figure out how to get it to work, so I went with Dictionary. I guess since my security levels are integers, and the HTML5 uses all strings in the option element, I just went with <<string string>>
public class SelectListHelper
{
public static Dictionary<string, string> GetAdminSecurityLevels()
{
return new Dictionary<string, string>
{
{"5 - Super Administrator", "5"},
{"4 - Management", "4"},
{"3 - Website Operator", "3"},
{"2 - Field Employee", "2"},
{"1 - Demonstration", "1"}
};
}
}
Finally the View, this part was hard to understand using Razor. I don't quite understand the use of m => m.SecurityLevel versus Model.AdminSecurityLevels or m versus Model.
The new SelectList converts the Dictionary to a Key Value Pair that Razor can use to create option elements out of the collection.
[Edit]
Now the weird part, is that I had to reverse the Key Value to Value Key. That part I don't understand.
<div class="form-group">
@Html.LabelFor(m => m.AdminSecurityLevels, new { @class = "control-label" })
@Html.DropDownListFor(m => m.SecurityLevel,
new SelectList(Model.AdminSecurityLevels, "Value", "Key"), new { @class = "form-control" })
</div>
Final Thoughts on this, wow that was a lot of work just to populate a dropdownlist or radiobutton list. I suppose in my future, as I write more code for these list, I will build a collection of them such as states and countries, and I can just add to the model, call it in the controller and just add it to my razor statement in less than 60 seconds.
Getting the whole thing to work including the jquery.unobtrusive.validator, Bootstrap.Css, MVC in general as a first time for me was a pain in the ass. But flashing back to Webforms and using new Listitem did take me a while to figure out as well. Oh well, new technology, hopefully it pays off in the future for me.
|
|
|
|
|
Hi all,
Please help me.
I have a file upload control and "onchange" of it I'm calling a "javascript function" and through that javascript method I'm invoking a "event" in the code behind.
But when I'm trying to check whether there exists a file in the file upload control it always says "false".
Please suggest me that how can i get the uploaded file in the code behind.
|
|
|
|
|
There's a problem with your code.
Since we can't see your code, we can't tell you what the problem is.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
File upload controls lose their state when the form is submitted, this is by design and is a security feature. You need to re-architect your solution such that you don't need to do a postback when the item changes. This could involve storing the file temporarily on the server, or some other mechanism. We don't know enough about your goal to know what the best approach could be.
|
|
|
|
|
I need to create an web application which shows the floor plan(Iteractive Map) of a building and in the building we have to locate our devices(using Drag and drop method). i googled to much but i could not find any complete tutorial. I do not have too much experience on .Net .
So I need some ideas on how to do this.There is any ways of doing this. Please suggest.
Your suggestions will be greatly appreciated. Thanks in advance.
|
|
|
|
|
Your issue is more to do with client-side technology than asp.net. Displaying something like a floor plan is going to need something a bit more advanced like html5 canvas
http://www.w3schools.com/html/html5_canvas.asp[^]
Lots of canvas tutorials if you google. The coordinates etc you can store in a database and have your asp.net generate the appropriate js that will draw the required shapes. For dragging and dropping google "jquery drag drop".
This isn't a trivial exercise though, if you're e beginner at .net this isn't a good starting project. It'd be best to go through some books on c# and asp.net first to understand the basics.
|
|
|
|
|
Main issue is with UI.
I have a box(with unique number) and it contain of 9rows and 9 columns i.e. total 81 slots.
4 slots are reserved per person sample i.e. 4 slots will be reserve per person.
Issue is that when sample of 20 clients are filled in slots i.e. total 80 slots are filled. The next sample of client will be store on box 1 81st slot and remaining 3 will be store in first 3 slot of box 2 and so on.
one logic is that we provide a list of checkbox with already filled slot corresponding that box will be disable and only next 4 checkbox will be enable. When he click on 81st checkbox the box number automatically changes to next box and 1st three checkboxs will be enable.
I have the logic but dont know how to implement the code.
modified 1-Nov-15 8:14am.
|
|
|
|
|