|
I'm using a webgrid in a MVC5 app. I'm having two issues:
- The last row does not have the same height as the previous rows. It's off by a couple of pixels. I'm not setting the height of the grid, it's parent div or anything like that, so I don't know why this is happening.
- I want three of the columns to disappear when the browser resolution gets below a certain size (when the device is a phone used in portrait mode). When the resolution changes to trigger the style change, the data columns are hidden, but the headers are still there.
".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 24-Mar-16 9:41am.
|
|
|
|
|
I've also tried MvcContrib.Grid, and a different issue with that.
I'm trying to put two action links in the last cell of each row. They are floating divs, but they refuse to line up.
The deletable columns also still don't delete.
".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
|
|
|
|
|
EVERYTHING SOLVED.
Conclusion - WebGrid is a half-ass control. MvcContribGrid is difficult to adjust to if you started out messing with WebGrid. There are some issues with Contrib.Grid regarding the style of the header row cells. When I use the Header(string), I get a warning saying the overload is obsolete, but I have to use that to get the borders to display correctly.
I got the deletable columns thing working (I had forgotten to uncomment the style spec for the appropriate style inside the media check).
".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
|
|
|
|
|
Web development sucks, doesn't it?
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Why, yes, yes it does.
".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
|
|
|
|
|
Especially if one has to maintain something like this monstrosity[^].
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Alright, I have my login stuff sorted, and it's time to start adding models that actually serve the web site's purpose. I'm a complete EF virgin, having been able to successfully avoid using it until today. What is the best (or typical) approach to adding models? Should each model (or model set) get its own dbcontext?
".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
|
|
|
|
|
God, no.
There are a few schools of though as to the appropriate use of DbContexts. The two that make the most sense to me are that you separate the models into domains and use a context per model domain, and the other is that you have a DbContext for each separate database. I prefer the latter, unless your object count bloats obscenely.
The important part is that the DbContext implements both the repository and UoW patterns, so design it as you would any repository and use it as a UoW.
The primary guidance that the Ef design team has always espoused is that only the first instance of a particular DbContext has much cost, after that the model has been generated and any further instances are cheap.
I hope that helps.
|
|
|
|
|
I only have one database. Would it make sense to use the AppDbContext (derived from IdentityDbContext) that already exists?
".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
|
|
|
|
|
No, I would quantify that as an object domain issue; Authentication and Authorization information should be separate from operational models.
|
|
|
|
|
Yep, I would leave the IdentityDbContext alone as it is used internally for Identity Framework. You should use your own DbContext for your database. I would recommend one dbcontext for one db.
|
|
|
|
|
Nathan Minier wrote: The important part is that the DbContext implements both the repository and UoW patterns,
Isn't it the DbSet that acts as the repository?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That's a fair question, and would certainly jive with some of the patterns I've seen built around EF.
My take on it is that a repository is not constrained to a single business object, especially in a relational setting where changes to object state can influence relations, so the DbContext is the repository. The functionally important part (to me) is that changes are tracked by the context, not the sets, and that multiple sets can have simultaneous changes tracked by the context.
This is entirely my personal opinion, I know, but from a design standpoint it makes a lot more sense to me.
Reading it again, I did make a mis-statement on the "implement UoW" part. "Supports UoW" would have been a much more appropriate statement, as it's entirely contingent on how you actually use the context.
|
|
|
|
|
Hi All.
I Create a website in this the login control connect to my SQL server (in the same machine) to verify user name and passs....
The connectionstring
<add name="RNOCDBConnecRNOCDB" connectionstring="Data Source=RNOCDB\;Initial Catalog=RnocDB;Integrated Security=True" providername="System.Data.SqlClient">
When I Run
http://localhost:4212/Default.aspx
It OK
But if I change the localhost by the server IP it has error:
Server Error in '/RNOC' Application
Login failed for user 'RNOC\RNOCDB$'.
|
|
|
|
|
Looks like you are not able to connect to your SQL server in hosting. Is the server from hosting company? Are you able to connect to it using SSMS?
|
|
|
|
|
Does your db sever require credentials?
".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
|
|
|
|
|
I am not sure but I Config IIS Identity to Local System and it work.Thanks all.
|
|
|
|
|
I have a ASP.net page with an update panel triggered by a few imagebuttons (outside the updatepanel). All works OK.
Starting the page through a rewritemap.config however the imagebutton click is not executed, it becomes active but the click is not fired anymore.
I now do not know how to continu troubleshooting this problem, can anyone help me? Or provide a link where to look for more information?
Thanks in advance
Erik
|
|
|
|
|
|
Hello John,
The link provided the answer:
after a Form.Action = Request.RawUrl at page startup the problem was solved.
Thank you very much,
Erik
|
|
|
|
|
|
Let's say you have an individual user authentication scheme on a MVC5 app. Two part question:
0) When a user tries to browse directly to a controller action that is not specifically marked with the AllowAnonymous attribute, will the user automatically get redirected to the login page, or do I have to code it to do so?
1) Is the Authorize attribute involved? If so, where do I put it - on the controller or on the individual actions?
(The MVC5 app template does not provide an example of how this is done, or if it does, I haven't discovered it.)
".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
|
|
|
|
|
Nevermind - I found the answer (and it is by using the Authorize attribute.
".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
|
|
|
|
|
0) When a user tries to browse directly to a controller action that is not specifically marked with the AllowAnonymous attribute, will the user automatically get redirected to the login page, or do I have to code it to do so?
You don't have to do anything. When a controller or action is decorated with [Authorize] attribute then the ASP.NET automatically redirects the user to login page if the user is not already logged in.
1) Is the Authorize attribute involved? If so, where do I put it - on the controller or on the individual actions?
If your all actions in a controller to be authorized then it makes sense to put the [Authorize] attribute at controller level. If you have to leave at least of one of actions to be [AllowAnonymous] then obviously you have no option other than doing it at action level.
Hope this makes sense
modified 23-Mar-16 9:45am.
|
|
|
|
|
i am familiar with form authentication. so please point out some difference between form authentication and claim authentication.
why people use claim authentication instead of form auth ?
in case of form auth a auth cookie is saved in client pc which pass to server for next subsequent request and check at server side which ensure user is authenticated or not.
so in case of claim authentication what kind of into is stored at client pc ?
please share the knowledge in detail and if any good write up exist on it then please redirect me there. thanks
tbhattacharjee
|
|
|
|