Welcome to AspAdvice Sign in | Join | Help

April 2009 - Posts

ASP.NET - alert

ClientScript.RegisterStartupScript( typeof ( Page ), "Startup" , typeof ( Page ), "Startup" , "<script>alert('Put your message here')</script>" ); ); use typeof instead of Me .GetType() or this .GetType()
Posted by mo meng | 0 Comments

ASP.NET - datetime format

Response.Write("<br />today:" + DateTime.Now.ToShortTimeString() + "<br />"); //today:8:56 AM Response.Write("<br />day:" + DateTime.Now.ToString("dd") + "<br />"); //day:30 Response.Write("<br
Posted by mo meng | 0 Comments

ASP.NET CheckBoxList SelectedIndexChanged

onselectedindexchanged of a checkboxlist, enable or disable a textbox <asp:CheckBoxList ID="OutPulseCB1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="OutPulseCB1_SelectedIndexChanged"> <asp:ListItem>NO</asp:ListItem>
Posted by mo meng | 0 Comments

gridiew - looping to get checkek checkbox

< asp : GridView ID ="GridView2" runat ="server" DataKeyNames ="userid"> < asp : GridView ID ="GridView2" runat ="server" DataKeyNames ="userid"> < Columns > < Columns >
Posted by mo meng | 0 Comments

SQL - Splitting

declare @string varchar(100) set @string = '1,Us,Jan;2,Ind,Rohit' declare @i as int set @i = 0 declare @temp varchar(100) declare @country varchar(100) declare @name varchar(100) declare @id int While(len(@string)>0) begin if (charindex(';',@string,0)>0)
Posted by mo meng | 0 Comments

Changing font size sample & using ID / clientID

using css .span10 { FONT-SIZE: 10px; } .span20 { FONT-SIZE: 20px; } function changefont(size){ document.getElementById(”span1”).className=”span”+size;} <a href="changefont(10)">10 size&nbsp;</a><br
Posted by mo meng | 2 Comments

JQeury testing sample

this is a sample test case to test whether you correctly include the JQuery file into your solution just click on the button and the alert will appear modify your path JQeury script path accordingly pls refer to http://docs.jquery.com/Main_Page for more
Posted by mo meng | 1 Comments

ASP.NET gridview RowDeleting

this is a sample code where user can add a record into the gridview (static in this example) and user can delete the records by calling the RowDeleting() event to delete the respective row <%@ Page Language="C#" AutoEventWireup="true"
Posted by mo meng | 0 Comments

ASP.NET round up to next 0.5

Dim dbl1 As Double = 2.4 If ((Math.Round(dbl1, 1) Mod 1) <> 0 AndAlso (Math.Round(dbl1, 1) Mod 1) <> 5) Then dbl1 = Math.Round(dbl1 - (dbl1 Mod 0.5) + 0.5, 1) End If Response.Write(dbl1) Share this post: email it! | bookmark it! | digg it!
Posted by mo meng | 3 Comments

Usefull site

HTML editor http://tinymce.moxiecode.com/ - free & do not need to include ddl http://www.fckeditor.net/ - free & dll needed http://freetextbox.com/ - response a bit slow & dll needed Learning Site http://forums.asp.net - from here you can
Posted by mo meng | 0 Comments

JavaScript - Re-Calculate subtotal/total when enter value in the textbox

Below is an example on how to recalculate the sustotal on a given datagrid which i did long time ago. This method can be applied to all table format control e.g. <table><gridview> etc firstly on the page load, it will call the onloadcalculate
Posted by mo meng | 0 Comments

SQL - ROW_NUMBER()

Raw table: ID Name Parent 1 A NULL 2 B4 8 3 A1 1 4 A2 1 5 B1 8 6 B2 8 7 B3 8 8 B NULL 9 A1 1 Reoder the result such as parent following by child (for 2-level ordering only) SELECT ROW_NUMBER() OVER (ORDER BY ISNULL(parent,id), ISNULL(parent,0), id),*
Posted by mo meng | 0 Comments

SQL - Get all the date within a date range

with CTE ( d ) as ( select d = convert ( datetime , '20080202' ) CTE ( d ) as ( select d = convert ( datetime , '20080202' ) union all select d = d + 1 from CTE where d < '20080204' ) all select d = d + 1 from CTE where d <
Posted by mo meng | 0 Comments