Love?

TRY TO MAKE DREAM COME TRUE

Quảng cáo

---

Thứ Bảy, 30 tháng 7, 2011

Dùng Jquery gọi hàm C#

Bài viết này mình sẽ minh họa các sử dùng jquery để gọi 1 hàm trong C#

Trước tiên bạn cần Download thư viện của jquery tại đây hoặc có thể download Video của bài hướng dẫn này ở cuối bài viết.

Viết code Javascript như sau:



Bạn cần một thẻ div và một nút button để hiển thị dữ liệu:

[

Trong file Default.aspx.cs bạn viết như sau:



Khi click vào button GetData thì dữ liệu sẽ được bind vào thẻ div



Bạn có thể download Video của bài viết tại đây

Chúc bạn thành công
Theo congdongcviet.com

Chủ Nhật, 17 tháng 7, 2011

Cắt chuỗi thành mảng (Split) trong J2ME

Tình hình là J2ME hiện ko còn hỗ trợ hàm split :(
Ta đành mày mò và làm vậy :D!

private String[] split(String original,String separator) {
Vector nodes = new Vector();
//String separator = ":";
//System.out.println("split start...................");
// Parse nodes into vector
int index = original.indexOf(separator);
while(index>=0) {
nodes.addElement(original.substring(0, index));
original = original.substring(index+separator.length());
index = original.indexOf(separator);
}
// Get the last node
nodes.addElement(original);
// Create splitted string array
String[] result = new String[nodes.size()];
if( nodes.size()>0 ) {
for(int loop=0; loop {
result[loop] = (String)nodes.elementAt(loop);
//System.out.println(result[loop]);
}
}
return result;
}