Ok I am working a problem regarding a web form built off Kendo (which i am very much still new to) the form in question has some fields which only appear under certain conditions. When they are visible they need to be required fields but when not visible they need to be ignored. I have been going through the code and have traced back to a CSHTML file that designates when these fields become visible. which i have posted below

    @model PhoenixOnlineMVC.Areas.EventManagement.Models.CompetitionPlannedElementItem
<script type="text/javascript">
     @Html.Raw(Model.Code)
</script>
<tr style="vertical-align: top;">
<td>@Model.Index</td>
<td>@(Html.Kendo().DropDownListFor(m => m.SelectedTypeId)
          .HtmlAttributes(new { style = "width:120px" })
          .DataTextField("Text")
          .DataValueField("Value")
          .BindTo(Model.Types)
          )</td>
<td>@(Html.Kendo().DropDownListFor(m => m.SelectedElementId)
           .HtmlAttributes(new { style = "width:160px" })
           .DataTextField("Text")
           .DataValueField("Value")
           .Events(events => events.Select(@Model.SelectedFunctionName))
           .DataSource(source => source.Read(read => read.Action("GetCascadeElements", "Event")
                                                           .Data(@Model.DataFunctionName))
                                        .ServerFiltering(true))
           .Enable(false)
           .AutoBind(false)
           .CascadeFrom(@Model.TypeComboBoxName)
           )</td>
<td style="width: 130px; overflow: auto">
    @{
              const string htmlHiddenAttributes = "width:120px; margin: 2px 4px 4px 0; display:none; ";
              const string htmlVisibleAttributes = "width:120px; margin: 2px 4px 4px 0;";

              if (Model.SelectedSuppElementId1 != null) 
                  { 
                      @Html.DropDownListFor(m => m.SelectedSuppElementId1, Model.SuppElements1, new { style = htmlVisibleAttributes })

                  }
              else
                  {
                      @Html.DropDownListFor(m => m.SelectedSuppElementId1, Model.SuppElements1, new { style = htmlHiddenAttributes })
                  }
              if (Model.SelectedSuppElementId2 != null)
                  {
                      @Html.DropDownListFor(m => m.SelectedSuppElementId2, Model.SuppElements2, new { style = htmlVisibleAttributes })
                  }
              else
                  {
                      @Html.DropDownListFor(m => m.SelectedSuppElementId2, Model.SuppElements2, new { style = htmlHiddenAttributes })
                  }
              if (Model.SelectedSuppElementId3 != null)
                  {
                      @Html.DropDownListFor(m => m.SelectedSuppElementId3, Model.SuppElements3, new { style = htmlVisibleAttributes })
                  }
              else
                  {
                      @Html.DropDownListFor(m => m.SelectedSuppElementId3, Model.SuppElements3, new { style = htmlHiddenAttributes })
                  }
              if (Model.IsTransition)
                  {
                      @Html.TextBoxFor(m => m.TransitionText, new { style = htmlVisibleAttributes })
                  }
              else
                  {
                      @Html.TextBoxFor(m => m.TransitionText, new { style = htmlHiddenAttributes })
                  }
          }
</td>
</tr>
    @Html.HiddenFor(m => m.Index)
    @Html.HiddenFor(m => m.CompetitionPlannedElementId)
    @Html.HiddenFor(m => m.CompetitionSkatedEventId)
    @Html.HiddenFor(m => m.SanctionPlannedElementId)
    @Html.HiddenFor(m => m.IsTransition)

I am interested in the @Html.DropDownListFor components Is there a way to add a required field to these? or possibly just in that part of the if statements?

Hi All, I am new to MVC , I am trying to render Questions with options having radiobutton. This is what I have tried , I am able to display question's with options having radiobutton, but I > can select only one radiobutton across the questions.

Model

public class CheckListModel()
{
  IEnumerable<QuestionModel> Questions {get;set;}    
}

Public class QuestionModel()
{
 Int Id {get;set;}
 string Question {get;set}
 IEnumerable<AnswerModel> Answers {get;set;}
}

Public class AnswerModel()
{
 Int Id {get;set;}
 string Answer {get;set;} 
}

View

@if (Model != null)
{
  if (Model.CheckListModel != null)
  {
    int i = 0;
    <div class="form-group">
      <fieldset>
      @foreach (var question in Model.CheckListModel.Questions)
      {
        <legend>@question.Question</legend>
        foreach (var answer in question.Answers)
        {
          i++;
          string nameAtt = "Grp" + i.ToString();
          <div class="radio">
            @Html.RadioButtonFor(a => a.eCheckListModel.Questions.Where( q => q.Id == 
              question.Id).FirstOrDefault().Answers.Where(b => b.Id == answer.Id).FirstOrDefault
              ().Answer, answer.Id.ToString(), new { @name = nameAtt, @id = nameAtt })
            @answer.Answer
          </div>
        } 
      }
      </fieldset>
    </div>
  }
}

What's is your preferences on dealing with cross-site scripting?

Do you like to escape user input before storing it to the database and not worry about encoding when outputting to html?

Or store the user input into the database without encoding and then encode all the user input when outputting to html?

What are pros and cons on those methods?

I'm new to asp.net, but have a question I cant find answer to (googled for a while now). My problem is:

I got my website running on a IIS 8.5.

When I visit the site, the url does not show the /default.aspx on the ending. only http://www.mywebsite.com/ I want it to automatically show http://www.mywebsite.com/default.aspx when I visit my home page, just as in html..

The website is up and running fine. But I got a graphic error with some highlighting since the page isn't /default.aspx

I got a temporary fix of adding a redirect rule, but want it permanently inside the webpage since I'm going to make more asp.net sites.

I am working on a web-app that will run full screen on the iPad, but I am having some issues with cookies storing and being read back properly.

At the moment all I know is that it works fine in Firefox on PC/Mac but does not work on Safari (Mac or iPad).

Code snippet, ASPX VB (saving):

Dim myCookie As HttpCookie = New HttpCookie("UserSettings")
myCookie("url") = Session("url")
myCookie.Expires = DateTime.Now.AddMinutes(10d);

(loading):

Session("savedUrl") = Request.Cookies("UserSettings")("url")

Is there something I am doing incorrectly that causes this code to fail on Safair?

I'm having this 6 item multiple carousel as shown in http://www.bootply.com/IQ5RPxXjZ9 and a normal 1 item carousel inside a same page. But because of the code below, the normal carousel doesn't slide properly from 1 image to another.

@media (min-width: 992px ) {

    .carousel-inner .active.left { left: -16.7%; }
    .carousel-inner .next        { left:  16.7%; }
    .carousel-inner .prev        { left: -16.7%; }  
}

how to make both sliders to work properly inside this same page?

I am trying to add a user to a role using the following code but the UserManager always returns a NULLReferenceException. Any tips for how to get this to work. I feel like it should not be that hard.

[HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult RoleAddToUser(string UserName, string RoleName)
    {



        ApplicationUser user = cd.Users.Where(u => u.UserName.Equals(UserName, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault();
        var account = new AccountController();

        account.UserManager.AddToRole(user.Id, RoleName);

        ViewBag.ResultMessage = "Role created successfully !";

        // prepopulat roles for the view dropdown
        var list = cd.Roles.OrderBy(r => r.Name).ToList().Select(rr => new SelectListItem { Value = rr.Name.ToString(), Text = rr.Name }).ToList();
        ViewBag.Roles = list;

        return View("Index");
    }

Here is my account controller

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using Owin;
using LaCeibaNetv4.Models;

namespace LaCeibaNetv4.Controllers
{
[Authorize]
public class AccountController : Controller
{
    private ApplicationUserManager _userManager;

    public AccountController()
    {
    }

    public AccountController(ApplicationUserManager userManager)
    {
        UserManager = userManager;

    }


    public ApplicationUserManager UserManager {
        get
        {
            return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
        }
        private set
        {
            _userManager = value;
        }
    }

    //
    // GET: /Account/Login
    [AllowAnonymous]
    public ActionResult Login(string returnUrl)
    {
        ViewBag.ReturnUrl = returnUrl;
        return View();
    }

    //
    // POST: /Account/Login
    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
    {
        if (ModelState.IsValid)
        {
            var user = await UserManager.FindAsync(model.Email, model.Password);
            if (user != null)
            {
                await SignInAsync(user, model.RememberMe);
                return RedirectToLocal(returnUrl);
            }
            else
            {
                ModelState.AddModelError("", "Invalid username or password.");
            }
        }

        // If we got this far, something failed, redisplay form
        return View(model);
    }

    //
    // GET: /Account/Register
    [AllowAnonymous]
    public ActionResult Register()
    {
        return View();
    }

    //
    // POST: /Account/Register
    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Register(RegisterViewModel model, string passCode)
    {

        if (ModelState.IsValid && passCode == "Fury")
        {
            var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };

            IdentityResult result = await UserManager.CreateAsync(user, model.Password);
            if (result.Succeeded)
            {
                await SignInAsync(user, isPersistent: false);

                // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                // Send an email with this link
                // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                return RedirectToAction("Index", "Home");
            }
            else
            {
                AddErrors(result);
            }
        }

        // If we got this far, something failed, redisplay form
        return View(model);
    }

    //
    // GET: /Account/ConfirmEmail
    [AllowAnonymous]
    public async Task<ActionResult> ConfirmEmail(string userId, string code)
    {
        if (userId == null || code == null) 
        {
            return View("Error");
        }

        IdentityResult result = await UserManager.ConfirmEmailAsync(userId, code);
        if (result.Succeeded)
        {
            return View("ConfirmEmail");
        }
        else
        {
            AddErrors(result);
            return View();
        }
    }

    //
    // GET: /Account/ForgotPassword
    [AllowAnonymous]
    public ActionResult ForgotPassword()
    {
        return View();
    }

    //
    // POST: /Account/ForgotPassword
    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> ForgotPassword(ForgotPasswordViewModel model)
    {
        if (ModelState.IsValid)
        {
            var user = await UserManager.FindByNameAsync(model.Email);
            if (user == null || !(await UserManager.IsEmailConfirmedAsync(user.Id)))
            {
                ModelState.AddModelError("", "The user either does not exist or is not confirmed.");
                return View();
            }

            // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
            // Send an email with this link
            // string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);
            // var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);       
            // await UserManager.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>");
            // return RedirectToAction("ForgotPasswordConfirmation", "Account");
        }

        // If we got this far, something failed, redisplay form
        return View(model);
    }

    //
    // GET: /Account/ForgotPasswordConfirmation
    [AllowAnonymous]
    public ActionResult ForgotPasswordConfirmation()
    {
        return View();
    }

    //
    // GET: /Account/ResetPassword
    [AllowAnonymous]
    public ActionResult ResetPassword(string code)
    {
        if (code == null) 
        {
            return View("Error");
        }
        return View();
    }

    //
    // POST: /Account/ResetPassword
    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> ResetPassword(ResetPasswordViewModel model)
    {
        if (ModelState.IsValid)
        {
            var user = await UserManager.FindByNameAsync(model.Email);
            if (user == null)
            {
                ModelState.AddModelError("", "No user found.");
                return View();
            }
            IdentityResult result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
            if (result.Succeeded)
            {
                return RedirectToAction("ResetPasswordConfirmation", "Account");
            }
            else
            {
                AddErrors(result);
                return View();
            }
        }

        // If we got this far, something failed, redisplay form
        return View(model);
    }

    //
    // GET: /Account/ResetPasswordConfirmation
    [AllowAnonymous]
    public ActionResult ResetPasswordConfirmation()
    {
        return View();
    }

    //
    // POST: /Account/Disassociate
    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Disassociate(string loginProvider, string providerKey)
    {
        ManageMessageId? message = null;
        IdentityResult result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(), new UserLoginInfo(loginProvider, providerKey));
        if (result.Succeeded)
        {
            var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
            await SignInAsync(user, isPersistent: false);
            message = ManageMessageId.RemoveLoginSuccess;
        }
        else
        {
            message = ManageMessageId.Error;
        }
        return RedirectToAction("Manage", new { Message = message });
    }

    //
    // GET: /Account/Manage
    public ActionResult Manage(ManageMessageId? message)
    {
        ViewBag.StatusMessage =
            message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
            : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
            : message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed."
            : message == ManageMessageId.Error ? "An error has occurred."
            : "";
        ViewBag.HasLocalPassword = HasPassword();
        ViewBag.ReturnUrl = Url.Action("Manage");
        return View();
    }

    //
    // POST: /Account/Manage
    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Manage(ManageUserViewModel model)
    {
        bool hasPassword = HasPassword();
        ViewBag.HasLocalPassword = hasPassword;
        ViewBag.ReturnUrl = Url.Action("Manage");
        if (hasPassword)
        {
            if (ModelState.IsValid)
            {
                IdentityResult result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword);
                if (result.Succeeded)
                {
                    var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
                    await SignInAsync(user, isPersistent: false);
                    return RedirectToAction("Manage", new { Message = ManageMessageId.ChangePasswordSuccess });
                }
                else
                {
                    AddErrors(result);
                }
            }
        }
        else
        {
            // User does not have a password so remove any validation errors caused by a missing OldPassword field
            ModelState state = ModelState["OldPassword"];
            if (state != null)
            {
                state.Errors.Clear();
            }

            if (ModelState.IsValid)
            {
                IdentityResult result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword);
                if (result.Succeeded)
                {
                    return RedirectToAction("Manage", new { Message = ManageMessageId.SetPasswordSuccess });
                }
                else
                {
                    AddErrors(result);
                }
            }
        }

        // If we got this far, something failed, redisplay form
        return View(model);
    }

    //
    // POST: /Account/ExternalLogin
    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public ActionResult ExternalLogin(string provider, string returnUrl)
    {
        // Request a redirect to the external login provider
        return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }));
    }

    //
    // GET: /Account/ExternalLoginCallback
    [AllowAnonymous]
    public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
    {
        var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
        if (loginInfo == null)
        {
            return RedirectToAction("Login");
        }

        // Sign in the user with this external login provider if the user already has a login
        var user = await UserManager.FindAsync(loginInfo.Login);
        if (user != null)
        {
            await SignInAsync(user, isPersistent: false);
            return RedirectToLocal(returnUrl);
        }
        else
        {
            // If the user does not have an account, then prompt the user to create an account
            ViewBag.ReturnUrl = returnUrl;
            ViewBag.LoginProvider = loginInfo.Login.LoginProvider;
            return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.Email });
        }
    }

    //
    // POST: /Account/LinkLogin
    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult LinkLogin(string provider)
    {
        // Request a redirect to the external login provider to link a login for the current user
        return new ChallengeResult(provider, Url.Action("LinkLoginCallback", "Account"), User.Identity.GetUserId());
    }

    //
    // GET: /Account/LinkLoginCallback
    public async Task<ActionResult> LinkLoginCallback()
    {
        var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(XsrfKey, User.Identity.GetUserId());
        if (loginInfo == null)
        {
            return RedirectToAction("Manage", new { Message = ManageMessageId.Error });
        }
        IdentityResult result = await UserManager.AddLoginAsync(User.Identity.GetUserId(), loginInfo.Login);
        if (result.Succeeded)
        {
            return RedirectToAction("Manage");
        }
        return RedirectToAction("Manage", new { Message = ManageMessageId.Error });
    }

    //
    // POST: /Account/ExternalLoginConfirmation
    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
    {
        if (User.Identity.IsAuthenticated)
        {
            return RedirectToAction("Manage");
        }

        if (ModelState.IsValid)
        {
            // Get the information about the user from the external login provider
            var info = await AuthenticationManager.GetExternalLoginInfoAsync();
            if (info == null)
            {
                return View("ExternalLoginFailure");
            }
            var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };
            IdentityResult result = await UserManager.CreateAsync(user);
            if (result.Succeeded)
            {
                result = await UserManager.AddLoginAsync(user.Id, info.Login);
                if (result.Succeeded)
                {
                    await SignInAsync(user, isPersistent: false);

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // SendEmail(user.Email, callbackUrl, "Confirm your account", "Please confirm your account by clicking this link");

                    return RedirectToLocal(returnUrl);
                }
            }
            AddErrors(result);
        }

        ViewBag.ReturnUrl = returnUrl;
        return View(model);
    }

    //
    // POST: /Account/LogOff
    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult LogOff()
    {
        AuthenticationManager.SignOut();
        return RedirectToAction("Index", "Home");
    }

    //
    // GET: /Account/ExternalLoginFailure
    [AllowAnonymous]
    public ActionResult ExternalLoginFailure()
    {
        return View();
    }

    [ChildActionOnly]
    public ActionResult RemoveAccountList()
    {
        var linkedAccounts = UserManager.GetLogins(User.Identity.GetUserId());
        ViewBag.ShowRemoveButton = HasPassword() || linkedAccounts.Count > 1;
        return (ActionResult)PartialView("_RemoveAccountPartial", linkedAccounts);
    }

    protected override void Dispose(bool disposing)
    {
        if (disposing && UserManager != null)
        {
            UserManager.Dispose();
            UserManager = null;
        }
        base.Dispose(disposing);
    }

    #region Helpers
    // Used for XSRF protection when adding external logins
    private const string XsrfKey = "XsrfId";

    private IAuthenticationManager AuthenticationManager
    {
        get
        {
            return HttpContext.GetOwinContext().Authentication;
        }
    }

    private async Task SignInAsync(ApplicationUser user, bool isPersistent)
    {
        AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
        AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, await user.GenerateUserIdentityAsync(UserManager));
    }

    private void AddErrors(IdentityResult result)
    {
        foreach (var error in result.Errors)
        {
            ModelState.AddModelError("", error);
        }
    }

    private bool HasPassword()
    {
        var user = UserManager.FindById(User.Identity.GetUserId());
        if (user != null)
        {
            return user.PasswordHash != null;
        }
        return false;
    }

    private void SendEmail(string email, string callbackUrl, string subject, string message)
    {
        // For information on sending mail, please visit http://go.microsoft.com/fwlink/?LinkID=320771
    }

    public enum ManageMessageId
    {
        ChangePasswordSuccess,
        SetPasswordSuccess,
        RemoveLoginSuccess,
        Error
    }

    private ActionResult RedirectToLocal(string returnUrl)
    {
        if (Url.IsLocalUrl(returnUrl))
        {
            return Redirect(returnUrl);
        }
        else
        {
            return RedirectToAction("Index", "Home");
        }
    }

    private class ChallengeResult : HttpUnauthorizedResult
    {
        public ChallengeResult(string provider, string redirectUri) : this(provider, redirectUri, null)
        {
        }

        public ChallengeResult(string provider, string redirectUri, string userId)
        {
            LoginProvider = provider;
            RedirectUri = redirectUri;
            UserId = userId;
        }

        public string LoginProvider { get; set; }
        public string RedirectUri { get; set; }
        public string UserId { get; set; }

        public override void ExecuteResult(ControllerContext context)
        {
            var properties = new AuthenticationProperties() { RedirectUri = RedirectUri };
            if (UserId != null)
            {
                properties.Dictionary[XsrfKey] = UserId;
            }
            context.HttpContext.GetOwinContext().Authentication.Challenge(properties, LoginProvider);
        }
    }
    #endregion
}

}

From what I understand client side MVC is when most of the data processing is done on the client side. AJAX is when a part of a webpage is updated instead all of it. That's all I know about both.

All the explanations I find online don't make sense to me (since I"m a beginner). Would someone mind explaining? Why is there a distinction between the two, they seem like the same thing.

I'm trying to access an Excel Template by a string URL from a controller.

  1. What directory should I place my Excel Templates in my Grails project? (i.e., WEB-INF, grails-app/assets, etc.,)
  2. What will the URI be for it after packaging it as a .war and putting it in the Tomcat 7 container??

Edit

I'm using

def wb = new WebXlsxExporter("/path/to/excel/template")

Which requires the string URL of where the file is stored.

Having 3 copies of the same model, how does this fit in with DRY principle? Or is DRY sacrificed to bring in better testability?

IS there a method that people use to automatically update each model? eg. If i have a User model/viewmodel/datamodel, and want to add IsDeleted property, I have to change in 3 places.

Am I missing something here??

In my view i have some checkboxes and their values include a Uri. In the controller i get the values of the checked checkboxes, download their content (text) and zip them.

It looks like that the zip file is created but when i am trying to download it never works. I do not get any error. even more worse i get Status 200.

AJAX in View.

 $(document).ready(function () {
    $('#GetTotal').on('click', function () {
        var prices = [];
        $('input[name="check[]"]:checked').each(function () {

            prices.push($(this).attr("value"));
        });
        $.ajax({
            url: "/AzureSearchService/DownloadAll",
            type: "GET",
            data: { coursePrices: prices },
            dataType: "json",
            cache: false,
            traditional: true,
            success: function () {
                alert("ajax request to server succeed");
            }
        });
    });
});

The checkbox

<input type="checkbox" name="check[]" value="@url" class="checkbox1" style="margin-left: 5px; margin-right: 5px;">

The Controller

public ActionResult DownloadAll(IEnumerable<Uri> coursePrices)
{
    var outputStream = new MemoryStream();
    using (var zip = new ZipFile())
    {
        foreach (Uri uri in coursePrices)
        {
            System.Net.WebClient wc = new System.Net.WebClient();
            Stream s = wc.OpenRead(uri);
            zip.AddEntry(uri.AbsolutePath +  ".txt", s);                 
        }

        zip.Save(outputStream);
    }

    outputStream.Position = 0;
    return File(outputStream, "application/zip", "all.zip");
}

Please find below the status by the browser What Browser Returns Status 200

In MVC, model, view and controller are three vertices of the triangle. It means, data can flow between the model and the view not through the controller. But in Entity bean/JSF view/managed bean pattern, the model can be accessed only through the controller. Thus, can i say Entity bean/JSF view/managed bean pattern is MVA not MVC(in upper level MVC is business logic/JSF view/FacesServlet)?

My goal is to make a cascading dropdown for country then state, where the data is on an SQL Server and not have to deal with the data persistence of postbacks/callbacks.

I can use an SQLDataSource to pull all the needed information on page load, but how do I run a query against that data source?

I have a function that fetches data from a json string which includes Norwegian characters. The problem is that the list i get based on my search in the Application is names without the Norwegian characters æ, ø and å. Why is this, and how can I get these back? This occurred only after i put the Fields in a updatePanel.

The result becomes: "Dag J�ran", but it really should be, "Dag Jøran".

i have sat the web.config to be like this after Reading about the topic on web, but it doesnt help:

<globalization 
requestEncoding="utf-8" 
responseEncoding="utf-8" 
fileEncoding="utf-8" 
responseHeaderEncoding="utf-8" 
culture="nb-NO"/>

Any help figure this out is very appreciated!

I am using this code for DropDownList:

@Html.DropDownList("VlogaNaziv", ((SelectList)ViewBag.DropListVloge).Select(t => new SelectListItem() { Text = t.Text, Value = t.Text, Selected = (t.Text == ViewBag.SelectedVloga) }), Model.VlogaNaziv, new { @class = "form-control"})

How can I implement this code: http://jsfiddle.net/pranavcbalan/v4gNL/ to my dropdownlist. In my dropdownlist I have only 3 values. 1) Admin, 2) Spediter, 3) SpediterOsnovni. I whant to my div is shown in chosen value 2) Spediter

Thanks for help.

Using MVC 4, I am populating a variable with knockout (in a razor view), and I want to pass that variable back to my controller through my viewmodel. For example

var selectedProgramOptions;
  $.ajax({
  type: "GET",
  contentType: "application/json",
  dataType: "jsonp",
  url: ceraSvcUrl + "/api/Registrations/GetRegistrationOptions?regId=@Model.Registration.Id",
  success: function (result) {
    selectedProgramOptions = result;

       $.ajax({
       type: "GET",
       contentType: "application/json",
       dataType: "jsonp",
       url: ceraSvcUrl + "/api/Programs/GetProgramOptions?programId=@Model.Registration.Program.Id",
       success: function (allProgsResult) {

          if (allProgsResult.length == 0)
             $('#programOptionsDiv').hide();

          for (var i = 0; i < allProgsResult.length; i++) {
             var match = false;
             for (var j = 0; j < selectedProgramOptions.length; j++) {
                if (allProgsResult[i].Name == selectedProgramOptions[j].Name) {
                   match = true;
                   self.AvailableOptions.push(new ProgramOption(selectedProgramOptions[j].Name, selectedProgramOptions[j].ChargeCode, selectedProgramOptions[j].Price, true, selectedProgramOptions[j].Notes, selectedProgramOptions[j].OptionGroup));
                 }
             }
             var chgCode = allProgsResult[i].ChargeCode;
             if (match == false && ["TG", "TN", "TP", "TV", "TW", "E2", "E3", "L2", "L3"].indexOf(chgCode) <= -1)
                self.AvailableOptions.push(new ProgramOption(allProgsResult[i].Name, allProgsResult[i].ChargeCode, allProgsResult[i].Price, false, allProgsResult[i].Notes, allProgsResult[i].OptionGroup));
             }
          }
      });

 }
 });

This is the code to populate the knockout field is the self.AvailableOptions. I need to put that field into @Model.Registration.AvailableOptions.

I am making website in which i have 2 page.one page work as panel bar and another page just define data.So can i change color from page-1 according to message printed on page-2?Thank you.

I have a pdf URL ( https://<<localhost>>/foldername/pdfname.pdf ) this should be run after authentication using login page.but it opens always, even without logged in. while try to open using address bar directly.

 window.open(<<URL>>, "_blank", 
  "height=800,width=850,status=yes,toolbar=no,scrollbars=yes,resizable=yes, menubar=no,location=no");

<asp:Panel runat="server" ClientIDMode="Static" ID="pnlScroll" CssClass="pnlScroll">

    <asp:UpdatePanel runat="server" ClientIDMode="Static" ID="TasksUpdatePanel" UpdateMode="Conditional">
        <ContentTemplate>
            <table class="taskGridView">
                <tr>
                    <td style="width: 25%;">
                        <asp:DropDownList ID="ddlTaskName" CssClass="chosen-select" DataSourceID="dsPopulateTaskName" AutoPostBack="true" DataValueField="Task Name" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlTaskName_onSelectIndexChanged">
                            <asp:ListItem Text="All" Value="%"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="dsPopulateTaskName" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2739] 'Task Name' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                    </td>
                    <td style="width: 20%;">
                        <asp:DropDownList ID="ddlService" CssClass="chosen-select" DataSourceID="dsPopulateService" AutoPostBack="true" DataValueField="Service" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlService_onSelectIndexChanged">
                            <asp:ListItem Text="All" Value="%"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="dsPopulateService" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2846] 'Service' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                    </td>
                    <td style="width: 10%;">
                        <asp:DropDownList ID="ddlStatus" CssClass="chosen-select" DataSourceID="dsPopulateStatus" AutoPostBack="true" DataValueField="Status" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlStatus_onSelectIndexChanged">
                            <asp:ListItem Text="All" Value="%"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="dsPopulateStatus" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2812] 'Status' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                    </td>
                    <td style="width: 15%;">
                        <asp:DropDownList ID="ddlDueDate" CssClass="chosen-select" DataSourceID="dsPopulateDueDate" AutoPostBack="true" DataValueField="Due Date" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlDueDate_onSelectIndexChanged">
                            <asp:ListItem Text="All" Value="%"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="dsPopulateDueDate" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT CONVERT(VARCHAR(14), [ATTR2752], 110) 'Due Date' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                    </td>
                    <td style="width: 15%;">
                        <asp:DropDownList ID="ddlOwner" CssClass="chosen-select" DataSourceID="dsPopulateOwner" AutoPostBack="true" DataValueField="Owner" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlOwner_onSelectIndexChanged">
                            <asp:ListItem Text="All" Value="%"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="dsPopulateOwner" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [REALNAME] 'Owner' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                    </td>
                    <td style="width: 15%;">
                        <asp:DropDownList ID="ddlClient" CssClass="chosen-select" DataSourceID="dsPopulateClient" AutoPostBack="true" DataValueField="Client" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlClient_onSelectIndexChanged">
                            <asp:ListItem Text="All" Value="%"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="dsPopulateClient" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2799] 'Client' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                    </td>
                    <td style="width: 15%;">
                        <asp:DropDownList ID="ddlSite" CssClass="chosen-select" DataSourceID="dsPopulateSite" AutoPostBack="true" DataValueField="Site" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlSite_onSelectIndexChanged">
                            <asp:ListItem Text="All" Value="%"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="dsPopulateSite" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2819] 'Site' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                    </td>
                    <td style="width: 15%;">
                        <asp:DropDownList ID="ddlPractice" CssClass="chosen-select" DataSourceID="dsPopulatePractice" AutoPostBack="true" DataValueField="Practice" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlPractice_onSelectIndexChanged">
                            <asp:ListItem Text="All" Value="%"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="dsPopulatePractice" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2817] 'Practice' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                    </td>
                    <td style="width: 15%;">
                        <asp:DropDownList ID="ddlProvider" CssClass="chosen-select" DataSourceID="dsPopulateProvider" AutoPostBack="true" DataValueField="Provider" runat="server" Width="100%" Font-Size="11px" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlProvider_onSelectIndexChanged">
                            <asp:ListItem Text="All" Value="%"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="dsPopulateProvider" runat="server" ConnectionString="<%$ ConnectionStrings:gvConnString %>" SelectCommand="SELECT DISTINCT [ATTR2919] 'Provider' FROM HSI.RMOBJECTINSTANCE1224 CT INNER JOIN HSI.RMOBJECTINSTANCE1232 S ON CT.ATTR2846 = S.ATTR2821 INNER JOIN HSI.USERACCOUNT UA ON S.FK2852 = (UA.USERNUM * -1) LEFT JOIN HSI.RMOBJECTINSTANCE1251 PXC ON PXC.FK2924 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1249 P ON PXC.FK2923 = P.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1248 PRXC ON PRXC.FK2912 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1230 PR ON PR.OBJECTID = PRXC.FK2911 LEFT JOIN HSI.RMOBJECTINSTANCE1247 SXC ON SXC.FK2908 = CT.OBJECTID LEFT JOIN HSI.RMOBJECTINSTANCE1229 SI ON SI.OBJECTID = SXC.FK2907 WHERE CT.ACTIVESTATUS = 0"></asp:SqlDataSource>
                    </td>
                </tr>
            </table>
            <asp:GridView ShowHeaderWhenEmpty="false" AlternatingRowStyle-BackColor="#EBE9E9" AutoGenerateColumns="false" OnSorting="yourTasksGV_Sorting" AllowSorting="true" ID="yourTasksGV" runat="server" ClientIDMode="Static" EmptyDataText="There is no data to display" OnRowDataBound="yourTasksGV_RowDataBound" OnRowCreated="yourTasksGV_RowCreated">
                <Columns>
                    <asp:HyperLinkField Target="_blank" DataNavigateUrlFields="Task Detail" DataTextField="Task Name" DataNavigateUrlFormatString="" HeaderText="Task Detail" SortExpression="Task Name" ItemStyle-Width="25%" ItemStyle-CssClass="taskTableColumn" />
                    <asp:BoundField DataField="Service" HeaderText="Service" SortExpression="Service" ItemStyle-Width="20%" ItemStyle-CssClass="taskTableColumn" />
                    <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" ItemStyle-Width="10%" ItemStyle-CssClass="taskTableColumn" />
                    <asp:BoundField DataField="Due Date" HeaderText="Due Date" SortExpression="Due Date" ItemStyle-Width="15%" ItemStyle-CssClass="taskTableColumn" />
                    <asp:BoundField DataField="Owner" HeaderText="Owner" SortExpression="Owner" ItemStyle-Width="15%" ItemStyle-CssClass="taskTableColumn" />
                    <asp:BoundField DataField="Client" HeaderText="Client" SortExpression="Client" ItemStyle-Width="15%" ItemStyle-CssClass="taskTableColumn" />
                    <asp:BoundField DataField="Site" HeaderText="Site" SortExpression="Site" ItemStyle-Width="15%" ItemStyle-CssClass="taskTableColumn" />
                    <asp:BoundField DataField="Practice" HeaderText="Practice" SortExpression="Practice" ItemStyle-Width="15%" ItemStyle-CssClass="taskTableColumn" />
                    <asp:BoundField DataField="Provider" HeaderText="Provider" SortExpression="Provider" ItemStyle-Width="15%" ItemStyle-CssClass="taskTableColumn" />
                </Columns>
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>

CSS:

#yourTasksGV {
    width: 145%;
    padding: 0;
    margin: 0 auto;
}
.taskGridView
{
    width: 145%;
    padding: 0;
    margin: 0;
    border: 0;
    border-spacing: 0;
    border-collapse: separate;
}
.pnlScroll {
    height: 480px;
    width: 100%;
    display: inline-block;
    overflow-y: auto;
    overflow: auto;
    position: relative;

    /* IE */
    scrollbar-base-color: #A0A0A0;
    scrollbar-base-color: #A0A0A0;
    scrollbar-3dlight-color: #A0A0A0;
    scrollbar-highlight-color: #A0A0A0;
    scrollbar-track-color: #EBEBEB;
    scrollbar-arrow-color: #FFFFFF;
    scrollbar-shadow-color: #A0A0A0;
    scrollbar-darkshadow-color: #A0A0A0;
}

displays this:

enter image description here

How do I modify the code so that the last three DropDownList is displayed as well as match the bottom GridView width for each TD?

I'm writing a console application in Visual Studio 2010, C#, .NET 4.5 to open a web page and create a PDF. The code below runs without errors, but creates an empty PDF (note: the basis of this is a code sample I found on the web). I've validated that the web page in the WebRequest is generated (I can paste the URL into a browser and the page is served). What I'm NOT sure of are the following:

  • The Stream object reports a size somewhat greater than 10k bytes. Is this too large?
  • The TextReader object has a 1024 byte buffer. Do I need a loop to refresh it to get the total content of the Stream object?
  • XMLWorkerHelper? Do I need an xHTML version of this class? If so, what namespace, class, etc?
  • Is there some other issue I need to address?

Thanks in advance...

if (rdr.HasRows)
{
    rdr.Read();
    WebRequest wReq = WebRequest.Create("http://LocalHost:52875/savemore.aspx?Chain=" + "Client"
                                    + "&Location=" + "Location"
                                    + "&CostPerUnit=" + rdr.GetDouble(3)
                                    + "&ProdSize=" + rdr.GetDouble(4)
                                    + "&Baseline=" + rdr.GetInt32(5)
                                    + "&TableName=" + "RpDispHist"
                                    + "&StartDate=" + strStartDate
                                    + "&EndDate=" + strEndDate);
    WebResponse wRsp = null;

    try
    {
        wRsp = wReq.GetResponse();
        Stream sRsp = wRsp.GetResponseStream();
        TextReader tRdr = new StreamReader(sRsp);
        Document doc = new Document();
        PdfWriter wPDF = PdfWriter.GetInstance(doc, new FileStream("New.pdf", FileMode.Create));
        doc.Open();
        XMLWorkerHelper.GetInstance().ParseXHtml(wPDF, doc, tRdr);
        doc.Close();
        tRdr.Close();
        sRsp.Close();
    }
    catch (Exception e)
    {
        Console.WriteLine("{0} exception caught.", e);
    }
}

I am trying to setup multiple applications within IIS, single server. I want all to use port 80 and the server has only one IP address. I have created two application (site1 and site2) within IIS and modified the 'Host name' under bindings on each as follows: site1.mywebsite.com site2.mywebsite.com

and kept the IP address and port values to be 'All unassigned' and '80' respectively.

I have "mywebsite.com" through godaddy, and not sure how should I configure dns zone file to take this into effect. Please help....

(My ultimate objective is to have n+1 sites hosted in the same server, so that site1.mysite.com through siten.mysite.com points to their respective application, and every other subdomain points to n+1 th application.

Is this a possibility?)

Thanks in advance, Anuruddha