Reference: http://forums.asp.net/1072828/ShowPost.aspx
Because DataList is databound control which repeats its item template as many times as there are rows in the data source to it. Therefore contents of template are wrapped into DataList’s Items (one DataList item per row in data source) which is a naming container to its contents (to keep control ID naming scope [...]
[Read more →]
Normally we use to Eval method to print out value retrieved from database to HTML. For example:
asp:Label id=”lblDate” runat=”server” value=’<%# Eval(myDr["DateAdded"]) >’
Assuming “DateAdded” is a date/time field in database, the above statement returns a date/time value from database.
Now, if you would like to show only date portion of it. You should define format string within [...]
[Read more →]
In case you still didn’t aware, there is no FOR loop in Transact-SQL (T-SQL). Anyway, you can replace it with WHILE loop, such as:
DECLARE @i int
WHILE(@i < 5)
BEGIN
– do whatever you want here –
SET @i = @i + 1
END
Remember to increment/decrement the counter. Else, you will ended up in infinite loop.
[Read more →]
Cookie with subkeys looks like this:
HttpCookie myCookie = new HttpCookie(“MainCookie”);
myCookie.Values.Add(“Email”, myDr["Email"].ToString());
myCookie.Values.Add(“User_Id”, myDr["Id"].ToString());
myCookie.Values.Add(“First_Name”, myDr["firstname"].ToString());
myCookie.Values.Add(“Last_Name”, myDr["lastname"].ToString());
myCookie.Expires = DateTime.Now.AddYears(1);
Response.Cookies.Add(myCookie);
[Read more →]
I am doing ASP.Net programming (using C#) these few days and I am thinking of a way to display interactive contents without post back the page. For example, there are two DropDownList, cboCategory and cboProduct respectively. If user clicked on cboCategory, all related products under the selected category will be displayed in cboProduct. In normal [...]
[Read more →]