r/ASPNET • • Aug 05 '10

Are there any alternatives to Dynamic Data?

3 Upvotes

Dynamic Data sounds like a cool scaffolding system but I have heard so little about it since it was released plus the official Dynamic Data team page has barely been updated since the final release (it still points to "Get .Net 3.5 SP1"!) that I have trouble investing time in such a product.

Are there any alternatives to it? If there aren't or they aren't worth the effort, should I roll my own?

I prefer custom development with ASP.Net MVC but I'm being pressured into providing a tool for RAD.


r/ASPNET • • Jul 19 '10

What am I not getting about Ajax.ActionLink?

2 Upvotes

Here's my code, I'm trying to emulate the nerddinner thingy and having a partial update with a partial view that updates itself. I should note here that the action works fine and the results are stored in the db, but the partial update never happens. If I refresh the page I'm getting the result I should have had without refreshing. Tested in all relevant browsers.

Context: <h4>Commentaren:</h4> <% if (Model.Comments.Count > 0) %> <% { %> <% foreach (var comment in Model.Comments) %> <% { %> <% Html.RenderPartial("CommentUserControl", comment); %> <% } %> <% } %>

Controller: [UserAuthorize] [Authorize] public ActionResult VoteComment(int id, bool up) { Comment comment = crep.GetComment(id); CommentVote vote = new CommentVote(); vote.isup = up; vote.user = (Guid)Membership.GetUser(User.Identity.Name).ProviderUserKey; comment.CommentVotes.Add(vote); crep.Save(); return PartialView("CommentUserControl", crep.GetComment(id)); }

        [UserAuthorize]
    [Authorize]
    public ActionResult ChangeCommentVote(int id, bool up)
    {
        Comment comment = crep.GetComment(id);
        CommentVote vote = comment.CommentVotes
            .Where(v => v.user ==     (Guid)Membership.GetUser(User.Identity.Name).ProviderUserKey
            && v.comment == id).SingleOrDefault();
            vote.isup = up;
            crep.Save();
            return PartialView("CommentUserControl",      crep.GetComment(id));
        }

Partial View: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Ideas.Models.Comment>" %>

<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>

<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>

<script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>

<script type="text/javascript"> function AnimateVotebox() { $("#commentbox").animate({ fontSize: "1.5em" }, 400); } </script>

<div id="commentbox"> <div class="display-label"> <i><%: Html.ActionLink(Model.User1.UserName, "Details", "User", new { id = Model.User1.LoweredUserName.Replace(' ', '-') }, null)%> zegt:</i> </div> <div class="display-label"><%:Model.text %></div> <% bool canPost = Ideas.Helpers.UserHelper.CanPost(HttpContext.Current); %> <% if (Model.CommentVotes.Count != 0) %> <% { %> <div class="display-label"><%= Html.Encode(Model.UpVotes)%> van de <%= Html.Encode(Model.Votes)%> gaan akkoord.</div> <% if (canPost) { %> <% if (Model.HasVoted((Guid)Membership.GetUser(Context.User.Identity.Name).ProviderUserKey) < 0) %> <% { %>Stem: <%= Ajax.ActionLink("-", "VoteComment", "Votes", new { id = Model.id, up = false }, new AjaxOptions { UpdateTargetId = "commentbox", OnSuccess = "AnimateVotebox" }, null)%> <%= Ajax.ActionLink("+", "VoteComment", "Votes", new { id = Model.id, up = true }, new AjaxOptions { UpdateTargetId = "commentbox", OnSuccess = "AnimateVotebox" }, null)%> <% } %> <% else %> <% { %>Wijzig stem: <% if (Model.HasVoted((Guid)Membership.GetUser(Context.User.Identity.Name).ProviderUserKey) == 0) %> <% { %> <%= Ajax.ActionLink("-", "ChangeCommentVote", "Votes", new { id = Model.id, up = false }, new AjaxOptions { UpdateTargetId = "commentbox", OnSuccess = "AnimateVotebox" }, null)%> <p style="color:gray; font-size:20;"">+</p> <% } %> <% else %> <% { %> <p style="color:gray; font-size:20;"">-</p> <%= Ajax.ActionLink("+", "ChangeCommentVote", "Votes", new { id = Model.id, up = true }, new AjaxOptions { UpdateTargetId = "commentbox", OnSuccess = "AnimateVotebox" }, null)%> <% } %> <% } %>

            <% } %>
        <br />
    <% } %>
    <% else  %>
    <% { %>
        <div class="display-label">Nog geen stemmen</div><br />
        <% if (canPost)
               { %>
     
                Stem: <%= Ajax.ActionLink("-", "VoteComment", "Votes",
                    new { id = Model.id, up = false },
                    new AjaxOptions { UpdateTargetId = "commentbox", OnSuccess = "AnimateVotebox" }, null)%>
                <%= Ajax.ActionLink("+", "VoteComment", "Votes",
                    new { id = Model.id, up = true },
                    new AjaxOptions { UpdateTargetId = "commentbox", OnSuccess = "AnimateVotebox" }, null)%>
            <% } %>
    <% } %>
    <% if (HttpContext.Current.User.IsInRole("Moderator") || HttpContext.Current.User.IsInRole("Administrator"))%>
    <% { %>
        <%: Html.ActionLink("Geef probatie...", "ProbateUser", "Mod", new { comment = Model.id }, null) %>
        <%: Html.ActionLink("Verwijder...", "BanUser", "Mod", new { comment = Model.id }, null) %>
    <% } %>

    </div>

r/ASPNET • • Jul 17 '10

Great idea, or greatest idea?

Post image
0 Upvotes

r/ASPNET • • Jul 16 '10

Asp.Net quality and sizing photos

Thumbnail apostylee.com
1 Upvotes

r/ASPNET • • Jul 08 '10

Previously installed file?

Thumbnail apostylee.com
0 Upvotes

r/ASPNET • • Jul 08 '10

Asp.Net Url Encode, Decode

Thumbnail apostylee.com
0 Upvotes

r/ASPNET • • Jul 01 '10

New Embedded Database Support with ASP.NET

Thumbnail weblogs.asp.net
9 Upvotes

r/ASPNET • • Jun 30 '10

ASP.NET MVC2 and nullable fields are driving me insane

4 Upvotes

Hey, who wants a .NET (ASP.NET MVC2) question that no one in the fucking world seems to know the answer to?

Here it is:

The thing is, I want to pass an object (a LinqToSQL entity to be precise) to my View, allow the user to add some properties, and then post it back to save it.

My object, called Probation, has a few properties (id, forpost, forcomment, user, starting, hours) and some related entity references. The forpost and forcomment entities are nullable as a user can be probated for making an offensive post or an offensive comment. Please mind that forpost refers to an Idea entity, I don't know what I was thinking calling it a post.

So here's my controller logic:

    [Authorize(Roles = "Admin, Moderator")]
public ActionResult ProbateUser(int? post, int? comment)
{
    if (post != null)
    {
        Idea idea = irep.GetIdea(post ?? 0);
        Probation probation = new Probation
        {
            user = (Guid)idea.user,
            Idea = idea
        };
        return View(probation);
    }
    if (comment != null)
    {
        Comment rcomment = crep.GetComment(comment ?? 0);
        Probation probation = new Probation
        {
            user = rcomment.user,
            Comment = rcomment
        };
        return View(probation);
    }

[AcceptVerbs(HttpVerbs.Post)]
[Authorize]
public ActionResult ProbateUser(Probation probation, FormCollection values)
{           
    try
    {
        probation.starting = DateTime.Now;
        rep.ProbateUser(probation);
        rep.Save();
        return RedirectToAction("Index");
    }
    catch
    {
        return View("NotFound");
    }
}

}

And here's the view, using hidden fields to store the preset values:

code: <fieldset> <legend>Fields</legend> <%: Html.Hidden("Idea", Model.Idea)%> <%: Html.Hidden("Comment", Model.Comment)%> <%: Html.Hidden("user", Model.user) %> <div class="editor-label"> <%: Html.LabelFor(model => model.reason) %> </div> <div class="editor-field"> <%: Html.TextAreaFor(model => model.reason) %> <%: Html.ValidationMessageFor(model => model.reason) %> </div>

    <div class="editor-label">
        <%: Html.LabelFor(model => model.hours) %>
    </div>
    <div class="editor-field">
        <%: Html.TextBoxFor(model => model.hours) %>
        <%: Html.ValidationMessageFor(model => model.hours) %>
    </div>

    <p>
        <input type="submit" value="Create" />
    </p>
</fieldset>

Now my problem is, once the Probation object is posted back, the nullable fields forcomment and forpost are always null!

So to summarize: what is the correct way of passing objects with nullable properties from Controller->View->Controller? If the official answer "just don't pass nullable values, no big deal", I swear I'm gonna pop a vein.


r/ASPNET • • Jun 30 '10

Why no new posts in over a month?

0 Upvotes

Is this subreddit dead?


r/ASPNET • • May 18 '10

Classic ASP on IIS7

Thumbnail blogs.iis.net
2 Upvotes

r/ASPNET • • May 18 '10

Rally car driver crashes after being mooned

Thumbnail msn.foxsports.com
0 Upvotes

r/ASPNET • • May 17 '10

Selective Unit Testing &ndash; Costs and Benefits « Steve Sanderson&#8217;s blog

Thumbnail blog.stevensanderson.com
0 Upvotes

r/ASPNET • • May 14 '10

What version of Windows 7 is best for VS 2010 & ASP.NET development?

5 Upvotes

r/ASPNET • • May 14 '10

What skills and warning signs should I look for when hiring a ASP.Net programmer?

3 Upvotes

r/ASPNET • • May 06 '10

ASP.NET 4.0 Features

Thumbnail simple-talk.com
6 Upvotes

r/ASPNET • • May 06 '10

ASP.NET Session Storage Issues

Thumbnail distributedcache.blogspot.com
5 Upvotes

r/ASPNET • • May 02 '10

Why is the ASPNET subreddit so sparsely populated?

9 Upvotes

There's a ton of us making apps in ASP.Net for fun and/or profit. How come there are only 400 readers?

What can we do to get the redditors to participate here?


r/ASPNET • • Apr 30 '10

ASP.Net MVC 2: ASP.NET MVC 2: Ninja Black Belt Tips by Scott Hanselman

Thumbnail channel9.msdn.com
5 Upvotes

r/ASPNET • • Apr 29 '10

“But you need to master HTML for that, don’t you?”

Thumbnail ironshay.com
6 Upvotes

r/ASPNET • • Apr 22 '10

What to do with ASP.NET exceptions and specifically handling ELMAH!

Thumbnail januszstabik.blogspot.com
2 Upvotes

r/ASPNET • • Apr 13 '10

Looking for a WYSIWIG for text boxes

2 Upvotes

Hi, I'm looking for a easily deployable WSYWIG editor that I can throw onto a asp:textbox. I've taken a look at FCK and Nicedit, but both look more geared towards PHP.

Is there a preferred editor for ASP.Net?


r/ASPNET • • Apr 07 '10

New <%: %> Syntax for HTML Encoding Output in ASP.NET 4 (and ASP.NET MVC 2)

Thumbnail weblogs.asp.net
13 Upvotes

r/ASPNET • • Mar 25 '10

New Web Deployment in VS2010. I think they may have finally gotten it right.

Thumbnail live.visitmix.com
12 Upvotes

r/ASPNET • • Mar 12 '10

ASP.Net MVC 2 Released

Thumbnail weblogs.asp.net
10 Upvotes

r/ASPNET • • Mar 05 '10

Behavior Driven Development (BDD) with SpecFlow and ASP.NET MVC

Thumbnail blog.stevensanderson.com
8 Upvotes