Forms Data Controls :: Formview Modes On Initial Page Load

Apr 13, 2010

I a formview object. I have created an edit temple and an empty template Whehn there is data in the table nor probem When my table is empty i got the empty template to display when I click insert I get the error " Form must be in insert mode" How can I tell if there is no data on the page load so I can maybe do this:

formview.f1.defaultmode = fornviewmode.insert

View 5 Replies


Similar Messages:

How To Use JQuery To Create Controls In The DOM After The Initial Page Load

Feb 14, 2011

about how many are using jQuery to create controls in the DOM after the initial page load.Curious also about any conventions for naming DOM objects in relation to database objects.Seems you could almost render the entire page using jQuery..Does that mean I am only using ASP.Net for the fact that my page methods will run in IIS on the web server?

View 17 Replies

Forms Data Controls :: Formview Change Mode On Page Load?

Feb 8, 2011

I need to Check a formview for records on page load and if empty, I need to set it to edit mode.

View 1 Replies

Forms Data Controls :: FormView Data Source Calling Select Function On Page Load

Mar 24, 2010

I have a GridView and a FormView on the same page. They both have separate DataSources. This is a simple Master Details configuration, when a someone clicks on the Select link in the GridView, the FormView brings up the Details data. But for some reason the FormView's DataSource is trying to retrieve data when I load the page. This is causing an error because no ID is passed from the GridView.

View 16 Replies

Web Forms :: At Initial Page Load Start A Thread

Jun 17, 2010

I have an application that initially display 4 grid views at page load. This process takes 50-60 seconds and I would like to change the process to display the web page, show message like "Data being loaded, please wait..." and then spin off a thread that fills the various grid view. When this is done I would programatically like to do a post back to show the result. Not sure if this is possible? I tried something like this:

[Code]....

View 1 Replies

Slow Initial Page Load

Jan 22, 2010

I'm writing a simple web site using codebehind for each page, however using the "codefile" directive, not "codebehind" as such, because I'm not precompiling. I'm just using a text editor to edit the aspx and codebehind files. Problem is, every time I make a change to the code or the aspx file, and refresh the page in the browser, it takes a 2 or 3 seconds to come up the first time, like it's doing an on-demand initial compile. I assume that's what it's doing, as after the initial load, the page refreshes without any delay at all.

This behaviour is quite frustrating when making small changes to the html or code. I'm coming from classic ASP, where you could edit-refresh-edit-refresh etc. all day without your "stride" being broken by waiting for a "compile", you know? So I'd love to know if there's a setting which prevents this initial delay. When I want to deploy, I can do a compile or something, but while making lots of small edits, I just need the page to run without that initial delay.

View 6 Replies

Radiobuttonlist And Load Page In Same Initial Position

Jun 17, 2010

I have this simple code in my page, I have a long page, if the client use this button then it shall reload the page and display the page from the beginning. I wish to be reload the page and display from the last position.

<asp:RadioButtonList ID="RadioButtonList5" runat="server" AutoPostBack="True"
RepeatDirection="Horizontal">
<asp:ListItem Value="45">Sheet2</asp:ListItem>
</asp:RadioButtonList>

View 1 Replies

Set Dropdownlist Selected Value On Initial Page Load

Jul 22, 2010

I posted a similar question previously, but none of the answers worked and I've been scouring all over the web trying to find a solution. My situation, I have a Edit Window webform with a dropdownlist (Note: to avoid confusion, I'm using Telerik extensions only to decorate the webform):

<%@ Page Language="VB" CodeFile="EditFormVB.aspx.vb" Inherits="EditFormVB" %>
<%@ Register Namespace="CustomBoundField" TagPrefix="custom" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Edit Pop-up</title>
</head>
<body class="">
<form id="form1" runat="server">
<div>
<script type="text/javascript">
function CloseAndRebind(args) {
GetRadWindow().BrowserWindow.refreshGrid(args);
GetRadWindow().close();
}
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)
return oWindow;
}
function CancelEdit() {
GetRadWindow().close();
}
</script>
<asp:ScriptManager ID="ScriptManager2" runat="server" />
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Vista" DecoratedControls="All" />
<br />
<br />
<asp:DetailsView ID="DetailsView1" DataKeyNames="ID" runat="server" AutoGenerateRows="False"
GridLines="None" DataSourceID="detailsSqlDataSource" Height="50px" Width="125px"
BorderWidth="0" CellPadding="0" CellSpacing="7">
<Fields>
<asp:BoundField DataField="TS_DESCRIPTION" HeaderText="TS_DESCRIPTION" SortExpression="TS_DESCRIPTION" />
<asp:BoundField DataField="TS_TITLE" HeaderText="TS_TITLE" SortExpression="TS_TITLE" />
<asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowInsertButton="True" />
</Fields>
</asp:DetailsView>--%>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Vista" />
<br />
<br />
<asp:DetailsView ID="DetailsView1" runat="server" Height="400px" Width="745px"
AutoGenerateRows="False" DataKeyNames="TS_ID" DataSourceID="SqlDataSource2"
EnableModelValidation="True">
<Fields>
<asp:TemplateField HeaderText="Category">
<EditItemTemplate>
<%--<asp:DropDownList ID="TTCategory" runat="server" DataSourceID="ReqCategoryData" SelectedValue='<%# Bind("TS_NAME") %>' />--%>
<asp:DropDownList DataSourceID="ReqCategoryData" DataTextField="ReqCategory" DataValueField="ReqCategory"
ID="reqCategoryDropDown" runat="server" AppendDataBoundItems="true" AutoPostBack="true" >
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Button" EditText="Update" ShowEditButton="True"
ShowCancelButton="True">
<ItemStyle HorizontalAlign="Center" />
</asp:CommandField>
</Fields>
</asp:DetailsView>
</div>
</form>
</body>
</html>

And in the code behind, I'm setting the datasource for the dropdownlist and using a function to query the DB for the name of the value I want to set as the selected value when the page loads initially: Partial Class EditFormVB Inherits System.Web.UI.Page

Public Shared category_Name As String = ""
Dim ddlDataSource As New SqlDataSource
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
DetailsView1.DefaultMode = DetailsViewMode.Edit
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Page.Title = "Editing record"
''Setup DropDownList SqlDataSource
ddlDataSource.ID = "ReqCategoryData"
Page.Controls.Add(ddlDataSource)
ddlDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("TTPRODReportsQuery").ConnectionString
ddlDataSource.SelectCommand = "SELECT TS_NAME AS ReqCategory FROM dbo.TS_SELECTIONS WHERE (TS_FLDID = 5299 AND TS_STATUS = 0) ORDER BY TS_NAME"
Dim args As New DataSourceSelectArguments
ddlDataSource.Select(args)
''Set max length of Title field to 70 characters
Dim dvrTest As DetailsViewRowCollection = DetailsView1.Rows
Dim TitleTB As TextBox = dvrTest.Item(0).Cells(1).Controls(0)
TitleTB.Attributes.Add("onkeydown", "isMaxLen(this)")
TitleTB.Attributes.Add("maxlength", "70")
Dim myDDL As DropDownList = DetailsView1.FindControl("reqCategoryDropDown")
''Perform dropdown list population operations
If Page.IsPostBack = False Then
Dim ticket_ID As String = getDataKey(DetailsView1)
''Fetch Category ID
Dim sqlText As String = "SELECT TS_REQCATEGORY FROM USR_ITFAC WHERE (TS_ID = " + ticket_ID + ") "
Dim reqDataReader As SqlDataReader = GetDataReader(sqlText)
reqDataReader.Read()
Dim category_ID As String = reqDataReader(0)
''Fetch Category name using the categoryID and set as selected value in dropdown list
sqlText = "SELECT TS_NAME FROM TS_SELECTIONS WHERE (TS_ID = " + category_ID + ") "
reqDataReader = GetDataReader(sqlText)
reqDataReader.Read()
category_Name = reqDataReader(0)
myDDL.DataBind()
myDDL.Selectedvalue = category_Name //<--this value gets set only when debugging,
End If
End Sub
Private Function GetDataReader(ByVal sqlText As String) As SqlDataReader
Dim dr As SqlDataReader
Dim sqlConn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("TTPRODReportsQuery").ConnectionString)
sqlConn.Open()
Dim sqlCmd As SqlCommand = New SqlCommand(sqlText, sqlConn)
dr = sqlCmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Return dr
End Function
End Class

The dropdownlist does get populated appropriately, however when I attempt to set the value, it doesn't reflect when the page loads; the dropdownlist just gets populated and no value is set to selected in the markup, so the first value is shown by default. The odd thing is that when I'm debugging, the value appears to get set when I step through the function, it's as if the selectedvalue is getting reset as soon as the function exits and proceeds to load the page.

SOLUTION: Had to add a separate function that is called onLoad from the DropDownList after the after Page_Load is done executing. Still unresolved is why the the DropDownList rebinds after the Page_Load.

IN HTML:
<asp:DropDownList DataSourceID="ReqCategoryData" DataTextField="ReqCategory" DataValueField="ReqCategory"
ID="reqCategoryDropDown" runat="server" AutoPostBack="true" OnLoad="DDL_DataBound">
IN CODE-BEHIND
Public Shared category_Name As String = ""
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Page.Title = "Editing record"
''Setup DropDownList SqlDataSource
ddlDataSource.ID = "ReqCategoryData"
Page.Controls.Add(ddlDataSource)
ddlDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("TTPRODReportsQuery").ConnectionString
ddlDataSource.SelectCommand = "SELECT TS_NAME AS ReqCategory FROM dbo.TS_SELECTIONS WHERE (TS_FLDID = 5299 AND TS_STATUS = 0) ORDER BY TS_NAME"
Dim args As New DataSourceSelectArguments
ddlDataSource.Select(args)
''Set max length of Title field to 70 characters
Dim dvrTest As DetailsViewRowCollection = DetailsView1.Rows
Dim TitleTB As TextBox = dvrTest.Item(0).Cells(1).Controls(0)
TitleTB.Attributes.Add("onkeydown", "isMaxLen(this)")
TitleTB.Attributes.Add("maxlength", "70")
Dim myDDL As DropDownList = DetailsView1.FindControl("reqCategoryDropDown")
''Perform dropdown list population operations
If Page.IsPostBack = False Then
Dim ticket_ID As String = getDataKey(DetailsView1)
''Fetch Category ID
Dim sqlText As String = "SELECT TS_REQCATEGORY FROM USR_ITFAC WHERE (TS_ID = " + ticket_ID + ") "
Dim reqDataReader As SqlDataReader = GetDataReader(sqlText)
reqDataReader.Read()
Dim category_ID As String = reqDataReader(0)
''Fetch Category name using the categoryID and set as selected value in dropdown list
sqlText = "SELECT TS_NAME FROM TS_SELECTIONS WHERE (TS_ID = " + category_ID + ") "
reqDataReader = GetDataReader(sqlText)
reqDataReader.Read()
category_Name = reqDataReader(0)
myDDL.DataBind()
End If
End Sub
Protected Sub DDL_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)
If Page.IsPostBack = False Then
Dim myDDL As DropDownList = DetailsView1.FindControl("reqCategoryDropDown")
myDDL.Items.FindByValue(category_Name).Selected = True
End If
End Sub

View 1 Replies

Mvc 2 Validation Always Shows Errors On Initial Page Load

May 14, 2010

I've searched around a lot, and honed this problem down to this case: I'm using the PRG pattern, pragmatically I'm using the same DTO for my post/get actions. It looks like when I have the dto with the data annotation attributes in the get action parameter list, the validation is always displaying errors, every time on initial page load. In some cases this could be desired behavior if you put asterisks in the error message, but how do I get rid of it?

View 1 Replies

MVC :: Html.ValidationSummary Appears On Initial Load Of Page And It's Empty

Jul 23, 2010

I am not sure what I am doing wrong in how I set up validation on my models and viewmodels. For some reason on several of my views that contain a validation summary, it appears empty on initial load of the page. On some other pages it appears correctly when the form's data is posted and it does not appear on initial load, this is the way that I would expect it to work.

On the views where this is occuring, my viewmodels are somewhat more complex in that they contain another complex type that I am passing around that has it's own set of DataAnnotation Validation properties, but I have called the validation summary like this; Html.ValidationSummary(true) so that those properties are not validated.

View 5 Replies

Configuration :: Slow Initial Page Load Speed And Compile Settings

Dec 8, 2010

Over the last week I've been investigating an issue for one of our clients whereby the initial page load following a deployment of their website takes around 1 minute, resulting in unacceptable downtime for end users. This was happening not only for code deplyments (bin dll's and .config files) but also if there were large numbers of .aspx pages updated. For code deployments it's not an issue, but for aspx updates it is; in this particular scenario, we are making use of a 3rd party content management system (RedDot from OpenText) in which every page of the site is published out as a distinct .aspx page. This means that for this website there's somewhere in the region of 2,400 separate .aspx pages. I realise this isn't an ideal situation but we're working within the constraints of the CMS, and we managed to correlate the instances where the site was unresponsive with App pool restarts, which also corresponded to publications of of .aspx pages.

I found an article by Tess Ferandez [URL] which describes all the reasons why the app pool may restart, and it does seem that if more than 15 .aspx pages are changed then the app pool will recycle and the pages will be re-compiled. Another msdn article [URL] then gave me a few pointers on how to start addressing this problem, and for the moment I've set a flag on the compilation options to prevent batch compilation:

<compilation batch="false">

This means that the initial page load now takes around 6 seconds instead of 1 minute, which is a great improvement. However, I also used the "Compilations Total" performance counter to investigate the number of pages that have been compiled by ASP.NET for my site and was quite surprised that the total number of pages that get compiled peaks at 44, which is odd given that there are 2,400 aspx pages in the site. If the batch flag is set to false, the counter slowly increments by 1 page at a time as you click around on the site; if batch mode is true, the initial compilation takes the number straight to 44 over the course of ~60 seconds. What I'm really struggling to understand is why all 2,400 pages aren't compiled. Does anyone have any inside info on what might be going on as all the documentation I've read seems to indicate that all of the pages should be compiled and this counter should be much higher.

View 1 Replies

Forms Data Controls :: Load EmptyDataTemplate Of FormView On PageLoad?

Nov 4, 2010

There is a page having formview with inserttemplate loading after user authentication. I have created user id = guest. If anyone login with guest i want to be load page FormView with EmptyDataTemplate.

View 11 Replies

Forms Data Controls :: Load FormView Data From Backend Using Dataset

Sep 19, 2010

I was searching for my problem for last couple of days. But coudn't find a better solution. So here I go again. What I did which worked great: I was going to a asp page with pre populated Dataset (dataset is already loaded with data), for a GridView. If I do the following .... the GridView shows all the data (with the fields Dataset comes with).

[Code]....

Now what I am trying to do: I am trying to do exact same thing but instead of using GridView, I would like to display data in a FormView. So now I tried to do this

[Code]....

PROBLEM: I can see the FormView Header with text "Test Dataset With FormView" and below the Header it displays the page numbers. I know that I have 3 data in the data set and I can see 3 page link in the FormView. But PROBLEM is it doesn't display any Field / Data. Not sure why it is doing this

Note that I wouldn't know what field to display in the FormView. Whatever I have in the Dataset I need to display. Is there any work around to accomlish my work (maybe by not using a FormView, but other conrol ?). My original goal is to Display Data in a Form View Format (One data at a time

View 2 Replies

Forms Data Controls :: Populate Dropdownlist In FormView With DataTable.load (DataReader)?

Jan 29, 2011

I have no problem when paging my FormView, the dropdownlist does not read the next record and keep the value of the first loaded record? All other textbox control behave normally and move from record to record excepted the ddl??Here the code.

Public Sub DoData()
Dim myConn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString)
Dim myCommand As SqlCommand = New SqlCommand("SelectSupplier", myConn)
myCommand.CommandText = "SelectSupplier"

[Code]....

View 3 Replies

Forms Data Controls :: DropDownList Bind Error - Force Order Of FormView And Child Controls Load?

May 4, 2010

I have a FormView with an EditTemplate.And the EditTemplate contains an ascx control:

<asp:FormView
ID="fvTicketUpdate"
runat="server"

[code]...

The contents of the ascx control has TextBox and DropDownList controls binding to the results of the FormView's ObjectDataSource through Text='<%# Eval("field1") %>'and SelectedValue='<%# Eval("field2") %>'.This works fine and I have been building all of my front end pieces like this as <asp:Panels> rendering as FieldSets that go 100% across the screen.And we call these areas "strips" accross the screen.But now I've run into a problem.One TextBox and one DropDown bind fine to a Ticket Object.But the DropDownList that works has its <asp:ListItems> hardcoded before hand.Now I have DropDownList that gets populated through a WebService in the ascx's
code behind like this:

public partial class UserControls_FormControls_PntipUpdtFaaInfo :
System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)

[code]...

The Problem I think is the FormView is trying to do its Bind to the objectDataSource before its child ascx control is loaded in the Edit Template.And I am getting this error:

Databinding methods such as Eval(),XPath(),and Bind() can only be used in the context of a databound control.Meaning that the control must already be databound to bind the selectedValue to a Property of the TicketObject.Is there an easy way to force the order of loading to make the PntipUpdtFaaInfo control load and have its Page_Load execute and bind ddlEquip before the FormView does its first dataBind and executing its Evals?Otherwise I have to take out the eval on the ddlEquip SelectedValue attribute and go to the Parent Page and hack and force everything to happen when it needs to.This layout has worked out well for me.All of the ascx area strips across the screen share the same Validation Summary for example.It allows me to think about one section at a time and the Properties to the Business Obect and CRUD methods as I go.But this is a big brick wall I've hit.

View 1 Replies

Forms Data Controls :: Modes Of DetailsView Control

Oct 6, 2010

I have a small question about the DetailsViewControl(DV).Probably most of us know there are three modes of a DV, edit, insert, and read-only.So we got edititemtemplate, insertitemtemplate and itemtemplate.Is there any actual difference between the 3 templates? I mean, if we don't generate the edit, insert and delete button by default. They are just three kinds of templates with different names, aren't they.

View 5 Replies

Web Forms :: Hide Divs On The Initial Load And Make Them Appear On A Postback Event?

Dec 1, 2010

I have several divs on an asp page. All of my divs are runat="server". On the initial load of my page I set all the divs visible property to false because I dont want them to appear on the first show. Then, I have a drop down list raising postback events.

On the selected index changed event I am setting the visible property of my divs to true to make them appear on the page. However this does not work.

I discovered that, on the initial load non of my divs are added to the page's html content. So, on a postback event non existing divs can not be made to appear. If all the divs would set to visible = true on the initial load, postback event would work just expected.

Could any one tell me a way to hide divs on the initial load and make them appear on a postback event?

View 3 Replies

Forms Data Controls :: Is Possible To Maintain Two Session Modes In A Single Application

Jul 23, 2010

"Is it possible to have two session modes in a Single Application"?

View 2 Replies

Web Forms :: How To Create Page Modes

Mar 16, 2010

I'm new to asp.net and I have a question.I'm working on a page where it has 5 Buttons. Add Edit Delete Save Cancel.I want each button pressed to change the page mode, a clear change would be the enabling/disabling of various controls on the page, including the Buttons themselves:On pressing Add, Page mode is changed and the buttons is disabled where Save and Cancel become enabled.I used Enum PageMode (View, Add, Edit), and a static variable "_pageMode", turns out it's a bad idea since more than one instance of that page can exist at one time, thus overriting each others' modes.

View 5 Replies

Forms Data Controls :: FormView/GridView Back And Forth Causes "Failed To Load Viewstate"?

Jun 12, 2010

I have a FormView and a GridView connected to the same datasource inside of a MultiView where one view is for the grid and the other for the form. The GridView has selection enabled and when the user selects a record in the GridView I make sure that the same record is selected in the FormView.mv.ActiveViewIndex = vIndexForm; // causes the MultiView to change views from the grid to the form
fv.PageIndex = gv.SelectedIndex + (gv.PageIndex * gv.PageSize); // causes the FormView to use the same selected record as the GridView

This should cause a PageIndexChanged event (it doesn't), so I called by event handler explicitly. In the event handler I change the mode to FormViewMode.Edit. This should cause a ModeChanged event (again it doesn't), so again I called it explicitly.Finally in the ModeChanged event I get the DataItem for the FormView so that I can update some special fields that require some special formatting, however fv.DataItem is null which means I can't do any special formatting. At this point the FormView shows and the regular fields are fine. If I now hit the Cancel button the FormView fires the ChangedMode event at which point I changed the MultiView's ActiveViewIndex back to the view with the grid. The grid displayes just fine, but if I do a select of a row within the GridView again I get the "Failed to load viewstate" error.I can only assume that I'm either doing something in the wrong order or at the wrong time and it's tripping me up.

View 4 Replies

Forms Data Controls :: Retrieve Parameter From Gridview (page 1) To Formview (page 2)

Jan 2, 2011

I am currently able to pass parameter from 1 page to another but I am unable to retrieve it.

<asp:HyperLinkField DataNavigateUrlFields="ID"

View 5 Replies

C# - App_Themes Not Loading On Initial Load

Jun 14, 2010

I have an application where different users can log in via a single portal login. When they log
in, if they belong to more than 1 company they have to select the company they belong to. The theme will change if there is a custom theme for that company. Each page my application has inherits a "CustomPage" class. Here is the code for the custom page:

public class CustomPage : Page
{
protected void Page_PreInit(object sender, EventArgs e)
{
if (Globals.Company != null && Directory.Exists(Page.MapPath("~/App_Themes/" + Globals.Company.CompanyName)))
{
Page.Theme = Globals.Company.CompanyName;
}
else
{
Page.Theme = "Default";
}
}
}

When the customer belongs to more than 1 company, and they select the company they belong to, the theme loads just fine. So, the problem I am having is this: If they belong to just 1 company, the company is automatically selected but the theme does not load right away. However, if I refresh the page, the theme loads just fine. Even the default theme will not load. The page has no css at all until I refresh.

I even view source and look for my css names and they are not there. I refresh and do the same thing, and they are there. I am not using forms authentication and the default theme in the web config is "Default"

<pages theme="Default">

View 1 Replies

Forms Data Controls :: Accessing Master Page Controls From Content Page Formview?

Sep 22, 2010

I have a master page with a textbox that I want to use for a search, and display the results on the content page.

I've dragged in the datasource to the content page, and configured the formview to use that datasource... almost.

The issue I'm having is that on the last step of the configure datasource wizard where you select the parameters, I want to select the master page textbox control for the search parameter... but of course it's not available in the list. The list only allows me to choose controls from the content page.

How do I set this master page search box as the parameter for my datasource?

View 4 Replies

AJAX :: AsyncFileUpload - Must Exist On Initial Load?

Oct 5, 2010

I've stumbled across a strange problem with the AsyncFileUpload control: if the control doesn't exist on the initial load, the UploadedComplete event does not fire. For example, the following code works just fine:

[Code]....

But as soon as the code is wrapped in an if (IsPostBack) condition as shown below, FileUploaded no longer fires, even though the code is otherwise identical:

[Code]....

Would anyone be able to shed some light on why this is happening?

View 3 Replies

MVC Switching Cultures After Compile For Initial Load

Nov 3, 2010

I have a hybrid ASP.Net web forms/MVC app. On one of the MVC "pages"/views, I have it render a bunch of dates using the ToShortDateString() and ToLongDateString(). These work correctly most of the time, but the first time I load the view after compiling the app, they are formatted incorrectly.

I traced this down and checked the current thread's culture. For 99% of the time it's en-US, but on the first load of the MVC view after compiling it is set to en-GB. If I reload the page immediately after that, it's back to en-US.

I have tried setting the culture and uiculture in the web.config file to en-US to force it to be correct, but no luck.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved