using vs2008 and building a web app. On a asp page called blackjack.aspx, I have four labels with id of lbBJTStatusP1 lbBJTStatusP2 lbBJTStatusP3 lbBJTStatusP4.I want to address those labels in a single sub by casting the casting two strings into the control name, so that string lbBJTStatusP & "1" would refer to lbBJTStatusP1.This is done on the code behind page. So far I have tried this but with no success. boxct refers to either "1" "2" "3" or "4".DirectCast(blackjack.Controls.Find("lbBJTStatusP" & boxct, True)(0), Label).BackColor = stoodcolor
I'm a noob to ASP.Net and I'm working on a simple project. In this project I have 2 drop down lists.In one drop down list I would like to select a panel web control and with the other select the background color for that panel.I can change the background color by calling the method Color.FromName() but selecting the panel object by casting it to a panel object from a string in a drop down list is stomping me.This is my starting code:
comparing integer values which are actually in string (varchar(9)) right now...I'm trying to do the following in a stored procedure..
SET @MinProjectYear = SELECT ProjYear FROM P_A WHERE ID = @ID SET @MaxProjectYear = SELECT ProjYear FROM P_A WHERE UserId = @UserID AND... IF EXISTS(SELECT 1 FROM P_A WHERE MinProjectYear <= MaxProjectYear) return true
The MinProjectYear and MaxProjectYear are varchar(9) values stored as "2007-2008", "2009-2010", etc. How do I split and compare the years?? i.e. check if 2007-2008 <= 2009-2010 ??
I have following code in my class file which returns me the Date field in format like 4/4/2010 12:00:00 AM from SQL SERVER
public IEnumerable Mthgetcomplaintdate() { var v = objderma.USP_Patient_Dermatology_Complaints_RepDate(PatientID); ; return v as IEnumerable; }
But on my aspx page i want to display only the Date part not time.One way is i will iterated throgh my dropdownlist which am binding with the above method and i convert it using Toshortdatestring() method.But i want to cast the whole Ienumerable result using some method? I have read about cast<> ,but could not understand how to implement it exactly.
I am attempting to use SqlBulkCopy to import data from an XML document. I receive the following error when executing WriteToServer: Invalid cast from 'System.String' to 'System.Guid'
Basically, what I did is that: I have a table in SQL database and some of data fields allow null. I built Objectdatasource through dataset. When I built update page using dataset. It generate the following error before showing the update page correctly. It seems I have issue to retrieve the null value from the database through using objectdatasource through dataset. Any suggestions?An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code
I am trying to write a table output from SQL database to a gridview/ Data List through an Object Data Source. I am a new starter and your help will be useful.
public List<Staff> GetStaff() cmd.CommandType = SqlConnection con = new SqlConnection(connectionstring);SqlCommand cmd = new [code]...
Above is my code. The error I'm get is, Unable to cast object of type 'System.DateTime' to type 'System.String'.
The column "To" and column "Subject" are strings and column "Receive" is DateTime. I can't made any changes in the database, so I need to write some code to handle casting a string to datetime or if statement as a work around.
[Code].... System.InvalidCastException was unhandled by user code Message=Unable to cast object of type 'System.Guid' to type 'System.String'. Source=System.Data.Linq System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execut
I will get this in a Raw format and i am writing this using Response.write("Some.xml"); I need to find out MerchantOrderNumber from this raw data how to obtain this
I have a label control in an aspx page, can i set value to the label from an handler file? How can i pass the reference of the label through query string?
am using C# ASP. NET 2.0. I have a string that has 4 parts that are separated by a '_' and here is what I want to do:Find the 3rd part of the string and change '-' to '/' in that string.Example: The string may be as shown: 100_John Doe_01-22-2010_08-00-00.txtI want to be able to pull out the date - in this example it is 01-22-2010, and then change the '-' in that string to '/' and display the
I have a label I want to display as a lovely number format i.e. {0:N0} Now, this label text equates to a query string value.How do I go about formatting a label's text from a query string value in one fell swoop?I have tried this
i have a function that return string format i want to use this function in HTML and set label's text property i use this code that i know it's incorrect how can i implement that?