Web Forms :: Set Variables - Get Value Using String
Apr 19, 2010
How i can get a value from string using regeular expressions? Sample string:
"<div>Weight is 200 g.</div>"
I need to parse this tring to get in my variable 200 Another question about multiple variables in same string
"<div>Dimentions is 55x100x60</div>"
In this case i need to set variables
Width = 55
Height = 100
Deep = 60
View 2 Replies
Similar Messages:
Mar 14, 2011
I have never passed along variables to a function before. I have a function here that should return true or false.
My question is, how I do this in a realtime example. How do you pass along the 4 string variables to the function and see if cbValid is true or false ?
[Code]....
View 2 Replies
Jan 9, 2011
The following is an example of using session state, which i can handle with a single variable. But this example uses. well you can see it. Where I am stuck is splitting the string into the three variables. Also, I am not too sure about the ; vs. a comma delimiter that usually see. I think it is a pretty old example. Session("Stocks") = "MSFT; VRSN; GE" ' Get Stocks, split string, etc. Dim StockString StockString = Session("Stocks")
View 6 Replies
Dec 2, 2010
I have a Sql string something like this.string sqlstring = "Select field1, field2 from table1 where field1 = 1 and field2 = 'xxx' group by field1, field2 order by field1 asc" Question: During runtime, based on the user selection, I have to replace 1 and xxx in the sql string.What is the best way to do this?
View 3 Replies
Aug 13, 2010
Some databases that my application has to access have their name according to the current year because the ERP we work with creates a new database every year, so, now it's working with the 2010db database. There are two options (as far as I know) for the ConnectionString property of a SqlDataSource: 1) hard-code it or 2) pick it up from the web.config file.
I don't want to change manually the connection string every year, so, how can I solve this? I would need to take the value of Now.Year either in the hard-coded ConnectionString or for the Web.Config ConnectionString, but I don't know how to do that.
View 3 Replies
Aug 17, 2010
How can I replace the field names in sql query string with variables like:-
string field1="ID";
string field2="Name";
sql = "Insert into [Sheet1$] ('" + field1 + "','" + field2 + "') values('1','abc')";
I am inserting data into an Excel document which has got nearly 100 columns.
I am inserting data using OLEDB as follows:-
System.Data.OleDb.OleDbConnection MyConnection ;
System.Data.OleDb.OleDbCommand myCommand = new System.Data.OleDb.OleDbCommand();
string sql = null;
MyConnection = new System.Data.OleDb.OleDbConnection(connectionstring);
MyConnection.Open();
myCommand.Connection = MyConnection;
sql = "Insert into [Sheet1$] (ID,Name) values('1','abc')";
myCommand.CommandText = sql;
myCommand.ExecuteNonQuery();
MyConnection.Close();
I want to specify the field names at runtime as mentioned above - sql = "Insert into [Sheet1$] ('" + field1 + "','" + field2 + "') values('1','abc')"; When I try this I am getting error.
View 12 Replies
Dec 20, 2010
I'm trying to use a function in my code behind to let me select a different column each time by calling the function with a different parameter.
However, I keep being told 'invalid column name', even though in the error page the column name appears perfectly valid.
Private Function getData(ByVal s As String) As String
View 4 Replies
Jan 2, 2010
I have this code in javascript: var x = e.mapX; It gets the X-coordinate of a map. What I want to do is that I want to store this into a c# variable. I have a class named Test with an integer property X. I want to store var x into X. In the codebehind, I have this on the Page_Load: Test test = new Test(); Then I am trying this on the javascript code: var x = e.mapX;
View 16 Replies
Aug 8, 2010
i am trying to collect 2 variables from one hyperlink, and use those variables in the page_load to set as session. but i don't know how to collect those 2 variables
such :
<a href="javascript:;" onclick="wsChangeColor('mainData', '#FF0000','#FFE4E1');return false;" title="Change color" id="red">1</a>
i would like to collect '#FF0000','#FFE4E1' or direct set '#FF0000','#FFE4E1' to string then send to pageload, how can i do this by only clicking on it ?
View 1 Replies
Mar 5, 2011
whats the exact use of static variables in overall programming in .net and for asp.net...
Recently i went for the interview where interviewer asked me 2 question which i was not sure for the same..
whats the use of session object, i said sessions are the server side object, they are used when you want to store user specific data at server side, then he asked what if i want to use static variables for the same, i was mum, can anyone tell me how asp.net will behave if i store the user specific information in static variables.If i use cookies which are the best option to store the data at client side (not sensitive one), but what if user has disabled cookies on his machine, will my application would crash.
View 3 Replies
Sep 15, 2010
I have this condition in my page_load event and it seems to be ignored, i do have it OUTSIDE of my !IsPostback condition. I need to check those sessions EVERYTIME you get to the page, regardless if its the first time on the page or if you have been on the page / site for a while.. those sessions are being set on a different page and this particular page needs those variables in order to work.. so if they dont exist they need to be sent back to the first page so they can be set.
[Code]....
View 9 Replies
Oct 6, 2010
i am developing a website in asp.net i have created a class "Utility" in App_Code Folder this class contains a static object of another class(LoginInfo) as described below:
[Code]....
This LoginInfo Class is my business object which only contains 2 properties UserID and UserName
Now what i am doing on my login page, after user authentication i am setting these properties with current logged in UserId and UserName
[Code]....
I am using this CurrentUser object on my webpage to get userid and username. It works fine, but after few minutes my CurrentUser.UserID and CurrentUser.UserName is set to blank string. I am not able to figure out what is the problem. may be due to asp.net recycles.
View 3 Replies
Feb 25, 2011
I am building an application in ASP.NET(C#). In certain forms I have many unused Varibales (declared as global variables).
I want to know whether these variables takes any memory space when i build the application.
For instance
public string _ID;
public string _Name;
View 3 Replies
Jul 11, 2010
Function RenderTips(ByRef passTipName As String, ByRef passYear As String, ByRef passTipNumber As String) As String
View 10 Replies
Aug 11, 2010
Im having problems passing a variable from my c# code behind into my asp as part of a connection string. how do i go about passing in a variable from my code behind into my asp.
View 4 Replies
Sep 1, 2010
I have been reading up on this all day, and I can't find the answer (or more likely, don't understand the answers I have found) to my problem. I am completely new ASP.NET and trying to make a trasition from Classic ASP.
In classic ASP it was possible to 'pass' variables between include files. In ASP.NET includes are very different. I'll keep this simple:
I have 'header', 'content' and 'footer' pages. The header and footer are both 'includes' in the content page.
I want to be able to pass a variable from the header to the footer. Heres a snip of my code so far:
[Code]....
[Code]....
[Code]....
However this errors crops up in the footer when run:
Compiler Error Message: BC30451: Name 'helloworld' is not declared.
So how do I make this variable available to the pages involved??
I imagine there is more than one way of doing this for many circumstances.
View 4 Replies
Feb 24, 2011
i facing a problem to change the date format at gridview display.
below is my coding:
[code]....
View 2 Replies
Jul 20, 2012
//Read string contents using stream reader and convert html to parsed conent var parsedHtmlElements = HTMLWorker.ParseToList(new StringReader(contents), null);
//Get each array values from parsed elements and add to the PDF document foreach (var htmlElement in parsedHtmlElements) pdfDoc.Add(htmlElement as IElement);
//Close your PDF pdfDoc.Close(); Response.ContentType = "application/pdf";
//Set default file Name as current datetime Response.AddHeader("content-disposition",
[Code] ....
Error: Input string was not in a correct format. Contents in html file giving error ...
View 1 Replies
May 7, 2015
Suppose i am having 25 character length string and I want to bind only first 15 character of that string into the label control.
<a href="[URL]" >"<span class="name" style="text-align: left; font-family: Arial; color: #0094DA; font-size: 14pt">
<%#Eval("Name").ToString().Length >= 30 ? Eval("Name").ToString().Substring(0, 30) : Eval("Name").ToString()%></span></a>
View 1 Replies
Feb 23, 2011
i have created a encrypted string to match with a target string to pass it along with client URL for authentication. it doesn't match. here is an algorithm used to create a encrypted string.
text = "astringtobeencrypted";
string strglobalkey = "mytestglobalkey";
string hexivkey = "testing12345";
ebCryptLib.eb_c_Cipher ci = new ebCryptLib.eb_c_Cipher();
string strhex1 = ConvertStringToHex(strglobalkey);
string strhex2 = ConvertStringToHex(hexivkey);
byte[] bytes = (byte[])ci.EncryptStringRaw(EB_CRYPT_CIPHER_ALGORITHM.EB_CRYPT_CIPHER_ALGORITHM_DES3_ECB,
strhex1, strhex2, text);
return Convert.ToBase64String(bytes);
the above alogithm returns a string which doesn't match with our targetted string provided by the client.
what should i do to match with the targetted string? The client had generated the encrypted string using PHP.
View 3 Replies
Dec 15, 2010
i have a gridview and i want all occurences of a particular string inside the gridview to be replaced with another string.
View 5 Replies
Jan 11, 2010
In my webform, I have placed several int variables to store values. While debugging the application, I surprised that I am getting the value stored in those variables in Hexadecimal format. I am not sure how this is happening. I didn't change any settings. Is this because of some settings problem?
However I verified the hexadecimal value in the sql server using the following query:
[Code]....
and the return result, 10003, which is correct. But I am not sure how it is converting to hexadecimal. This is not happening earlier.
View 4 Replies
Jul 17, 2010
i have deployed my website on a particular server. i have some limitations in using viewstate and session variables. those pages in which i have used ViewState variables (for storing some information), i user accesses that page and does not do any activity for 5 minutes and if after 5 minutes he does any kind of activity (click on Link or button etc) then he receives following error: "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster."
how i can avoid above error? another problem is with session. My session expires just after 2-3 minutes. What should i do for maintaining session for long time? i can not use cookies, as if user has disabled the cookies then my website will not work...
View 2 Replies
Mar 17, 2010
I was wondering if it is possible to assign 2 variables to DataView.RowFilter. if it is, how do I code it.
I have tried this:
[Code]....
but i got this error
Missing operand before 'and' operator error
View 3 Replies
Oct 5, 2010
VS2010/VB/ASP.NET 4.0 If an error occurs in an ASP app you can redirect it to a default page which is defined in the web.config file How can you pass the variables (URL) to the error webpage then to a logfile or sent via an e-mail address?
Example: 404 Error
- Page hosting the link
- URL
- Search (if applicable)
View 3 Replies