Is it possible to have an initial drop box item that has a null value. For instance I have a drop box that iss linked to the EmployeeName column in the table Employees in and SQL Database. When running the page it shows the first employee, cn i hae it so when the page loads instead of selecting the first employee it would say something along the lines of "Please select employee..." Maybe have the text in grey to show that it needs something selecting.
How can I have 2 Cascading Drop Down Lists for the same Drop Down List?here is my problemi have 3 drop down lists read from database1- Schools List 2- Classes List3- Teachers ListEvery School will have more than 1 Class and more than 1 TeacherWhat I want is when user select a School from Schools Drop Down List then BOTH (Classes and Teachers) should be refreshed based on the School Drop Down List
I encounter a weird problem when I am run the app via F5 or View In Browser. When I run the following page for the first time, "Hello" is shown on the textbox. Clicked on the 'Click Me' button, the text is changed to "Clicked!". That's fine. Close the brower and run F5 (or View in Browser) again, the Textbox shows "Clicked!". It doesn't display the initial value anymore. I see this problem on IE6 (and thatis the only option for my employer), but not on FF3.6 nor Googgle Chrome 4.x. I thought it could be related ViewState. But, the problem persists after ViewState is disable.
Default.aspx File below:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!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">
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.
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:
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"
My application is hosted on IIS6.0 web server. And we observed that the initial page load time is high (30-40 sec) and further page loads take only 5sec.To bring down the page load time, I have deployed the precompiled web solution on IIS.But unfortunately the initial page load time did not came down to larger extent.
What is the value of SomeId after I create an instance of my object? I was testing it with SomeId == 0 but it wasn't working. Then I tried null which gives me an error.
What is the right way to handle this? Am I to assign an initial value to my objects' properties in the object? If not, how do check if my object has any values assigned to its properties -- in particular, int values?
I have the following string John Adams, however I would like to get JA where J is the first intial of the firstname and A is the first initial of the lastname..How do I do so? Thank you.
a basic step for creating a web application using c#?I am confused about how to use it, since I don't know how to write an event for a button, etc.I also don't know the difference between an input button and an asp.net button.
I have a project it is similar to rapidshare.There is a user table.In this table there are username,password,uploadlimit and registertime.user has 10 mb upload limit.How can i do: user uploadlimit set initial value for each month?For example user has signed up in 02.06.2010.He or she has uploaded file 9 mb between 02.06.2010-02.07.2010.When the server time will be 03.07.2010 the user uploadlimit will update 10 mb again?
I have an application where I currently are calling stored procedures, reading tables and filling GridView at PageLoad (If Not IsPostBack Then ...). The process takes some time and leaves the client waiting for this process to be completed even before showing the page.Now, is there a way where I can open the page, show a hour glass (or similar) and then automatically fill the gridviews? Is this where I should use threading (or backgroundworker) ?
I am working on ASP.NET 2.0, I have a list of books Name in my master table, while entering new book name in Textbox I want to display the book names starting with those initial characters. How to achieve this.AJAX, silver light.Etc.google like feature..
First of all, i have multiple aspx files in my project that run fine when i build my project, however, something has happened and im no longer able to run "NEW" aspx files. I continually get the error "Parser Error Message: Could not load type 'newebrpss.Contracts'." which doesnt make sense because
[Code]....
Keep in mind..all im doing is just creating the file through right click project>>>new item>> Contracts.aspx and hit run only to get this.
Within an ASP.NET AJAX UpdatePanel on my page I have a submit button which has some custom javascript validation applied which set a global _cancelGeneralSettingsUpdate flag depending on the results of the validation.In this case the variable _cancelGeneralSettingsUpdate is correctly set to false but the initializeRequest function is not called before the page attempts to postback via AJAX, causing the postback to fail. I need to be able to have postbacks succeed once the invalid input has been corrected and the user clicks the submit button again. Unfortunately I do not seem to be properly wired into the PageRequestManager pipeline once postback has been cancelled. If I refresh the page, everything works again, but cancelling the postback via args.set_cancel(true)
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.
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):
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
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?
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.