Web Forms :: Binding Expressions In Server Controls?
Sep 3, 2010i'm trying to do the following:
[Code]....
i'm trying to do the following:
[Code]....
I have a ListBox that contains userNames which is inputted by a user during run time. This number of items in the ListBox is dependent on the user's input. These userNames will then be used in a Lambda expression like this:
var vHandleResult = vHandleResult.Where(a => a.UserName.Contains("userName"));
This works fine when there is only 1 user in the ListBox but doesn't produce the correct results when there are multiple items in the listBox. I tried manually creating the expression which should be written as this:
var vHandleResult = vHandleResult.Where(a => a.UserName.Contains("userName1") || a.UserName.Contains("userName2") || a.UserName.Contains("userName3") || a.UserName.Contains("userName4"));
I tried forming the "a.UserName.Contains("userName") expression as a string which is dependent on the number of the items (using foreach) and then just plug in the resulting string in the expression but it seems that it doesnt accept string as an expression.
using .net 4 and vs2010
I'd like to get the text value of a column of my datagrid and insert that text into the subject line of an email.
The partial code I've tried is below in bold, however, it does not produce the correct result.
[Code]....
I've also tried various other inline expressions, including <%#DataBinder.Eval (Container.DataItem("FullName")) %> and <%# Eval("FullName") %>
[code]...
I get the Subqueries are not allowed in this context. Only scalar expressions are allowed - i am going to run into this quite alot so I figuredI'd better see what the right way is!
Does anyone know where I can find some info on how to support data binding in my control? I would like to get data primarily from a sql server.
View 3 RepliesI have two the below regular expressions for a textbox , to validate.
^(([01]?dd?|2[0-4]d|25[0-5]).){3}([01]?dd?|25[0-5]|2[0-4]d)$ - Validation Expression For IP Address
^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z]|[A-Za-z][A-Za-z0-9-]*[A-Za-z0-9])$ - Validation Expression for Host name
I want to use both these for the same textbox, It should fullfill either of these conditions. What should I do so as to satisfy my condition.
[Code]....
View 1 RepliesI have a control inherited from datalist because I want all the same functionality but with a couple of extra properties.
I have a method that goes off and gets the data inside the control (instead of using a separate datasource ID). It's reading it from XML into a datatable.
If on the code behind of the aspx page I put the control on I put a thecontrol.databind() in the page load, all works well.
However I'd rather not have to do this, instead the control should bind itself.
I gather it's something to do with the order of events but I'm not sure what to do about it.
I don't want to reinvent the datalist wheel, just add a couple of properties and get it's own data
Sample code (some code removed for clarity)
[Code]....
I applied regular expression validator on date of birth and Missing date for a missing person. the missing date should be greater than the date of birth . I applied compare vallidator but it is not working properly. it comparing day of date of birth with day of missing date, both months and years...
if i give...
date of birth:Â 2/2/1980
Missing date: 1/2/1981
it is giving the error message...
I applied this regular expression:
^((0?[13578]|10|12)(-|/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[01]?))(-|/)((19)([2-9])(d{1})|(20)([01])(d{1})|([8901])(d{1}))|(0?[2469]|11)(-|/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[0]?))(-|/)((19)([2-9])(d{1})|(20)([01])(d{1})|([8901])(d{1})))$
I am getting ready to just write my own, but I have a need for some regular expressions that will validate strings to make sure they are in an acceptable format to be inserted/updated into a database field. I figure it may just be to find a list of them someone has already posted somewhere and just use those.
View 3 RepliesI have image control in my page I want bind it from DB how i can do it?
it is not in datalist or gridviewÂ
 <asp:Image ID="Image1" runat="server" />
I have a website created in asp.net and have the following fields displayed in the grid view linked through a database.First_Name Last_name City Username Password Email Mobile Genderplease let me how I can put validations when the edit button is clicked and the textboxs popout...I have tried a lot of ways like edit template and all but they have not been helpfulReallyIf you need I can also post the code I am using..
View 1 RepliesCode to read the span having the particular class name and assign to match collection.
I am having a set of html tags.
<span><a href="asb.aspx">Dummy</a></span>
<span class="active"><a href="abc.aspx">Hi thi is titile</a></span>
I need to get the span having the class name ="active".That is i need the result
<span class="active"><a href="abc.aspx">Hi thi is titile</a></span>
It will be fine if i get the text in the a tag that is with in the span having the class name "active".
I am trying to find a way to limit the inputs on a webpage to a variety of different sequences, and although I have worked through the regular expression library, I am still confused on how to allow decimal places and a maximum value. I initially used rangevalidators, but as you know, these only limit the inputs to a range, and have no control over the decimal places entered. A variety of limits i have been asked to implement are:
1. Range 0-45, 0 decimal places
2. Range 0-20, 2 decimal places
3. Range 16-65, 0 decimal places
4. Range 0-99, 2 decimal places
5. Range 0-1500000, 0 decimal places
6 Range 0-200, 1 decimal place
For 1 and 5 respectively, I have used
([0-9]|[0-9]d|45)$
([0-9]|[0-9]d|1500000)$
but want to be sure that I have understood the pattern correctly. How do I then go about creating a pattern for the other examples?
I have a Microsoft ASP.NET chart control. When I bind it to SQL data, it displays nothing. I used a DataList to bind the same data and there are results. Here is the code. What am I doing wrong?
(p.s. the code is below)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!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">
[Code]....
i get the above error when i try to run this sql statement
INSERT INTO PSPS_Posts (Post, Date_Posted, user_ID, Thread_ID) VALUES (@Post, @Date_Posted, @user_ID, (SELECT Thread_ID FROM PSPS_Thread WHERE Thread_ID = (SELECT MAX(Thread_ID) FROM PSPS_Thread
So what I'm trying to accomplish is this
[Code]....
The user control has public properties named accordingly and the page has protected properties accordingly which I've verified have the desired values.
For some reason the values are always empty strings or 0s in the usercontrol, no matter what the page property is.
i have the code:
Regex r = new Regex("<tag>([^<]*)</tag>");
but i want to add another set of tags to search between:
Regex r = new Regex("<tag>([^<]*)</tag>|<asd as="b">([^<]*)<asd as=j>");
this does not work.
I am tring to calculate the expressions then my problem is when give in double values it did not working and error with undefined symbol(.). I am using one class file for evaluting the expression.
ex: 10/2+58*7-69 //valid
5655/854*564-552+64/42+215 //valid
but
52.36+56.2 // Not valid
Above are the examples for evaluting method, how can evalute double values give me sample code
if there are two consecutive apostrophe or two consecutive hyphens or two consecutive comma or two consecutive spaces or two consecutive periods or two consecutive periods..I want to display those particular error.
and One more thing is if there are any of the above combinations like apostrophe+hyphen or apostrophe+space or hyphen+space, I want to throw that specific error.
i take the text of the html of a site and want to select a substring of the whole text. the text is something like this
[Code]....
I think it can be solved by Regular expressions but maby I'm wrong.
I upload a .html file which is saved from a webbrowser. I read the stream and with Stringbuilder I make a string of it.But now I want to have only the data which is in this div:
[Code]....
My question:
Is it possible to design a page in Expressions Web and then use it in Visual Studio Presently, I am using an asp.net master page in Visual Studio with functionality from the VS tool box (navigation tree, login etc). These work fine but they are not very pretty. How can I keep all the functionality that Visual studio offers (I will be adding an SQL database) but have it looking better than the drag and drop tools in VS. Is it possible or not to connect an Expressions Web Master page easily, so it will drive the site already built in VS - but have a more attractive GUI?
Or, is there something that I am missing in Visual Studio - can I edit the drag and drop tools in there to build a GUI with a Microsoft feel and look?
I have got a datatable which contains many columns in which three are main:
hotelid
dshotelid
hotelname
Some hotels contain only dshotelid, some contains only hotelid and some contain both dshotelid and hotelid.
I need sort in such way so that those hotels who got both dshotelid and hotelid should be on top and then those hotels who have got only dshotelid and at last those hotels who have got only hotelid...
I created this :
dtmaintable.DefaultView.Sort = "dshotelid, hotelid"
but it Is not giving me desired output.
As I have the URLs like
http://somedomain.com/products.aspx?id=1
and i want to rewrite this like
somedomain.com/productname and rest of the URLs on the domain work as they are provided.
like
somedomain.com/forums/categories.aspx
I don't want to rewrite these other URLs