asp.net mvc json ÐòÁл¯À©Õ¹·½·¨
¼Ç¼һ¸öС·½·¨£¬ÈÃÈκζÔÏó¶¼ÊµÏÖjsonÐòÁкúµÄÀ©Õ¹·½·¨:
using System.Web.Script.Serialization;
...
//
public static string ToJSON(this Object obj) {
return new JavaScriptSerializer().Serialize(obj);
}
...
Ïà¹ØÎĵµ£º
ÍøÕ¾ÎļþÃû£º
1¡¢ ÍøÕ¾ÎļþÃûÒÔ±ê×¼Ó¢Îĵ¥´ÊÃèÊöÒµÎñÄÚÈÝ¡£Èç¹û1¸öÓ¢Îĵ¥´ÊÎÞ·¨ÃèÊö£¬¿ÉÒÔÔö¼Ó2¸ö»òÕß3¸ö£¬µ«¾¡Á¿ÎªÍêÈ«µ¥´Ê£¬ÀýÈçarticle.aspx/ articleView.aspx / articleList.aspx µÈ¡£
2¡¢ ÎļþÃû¾¡Á¿²»ÓÃÊý×ÖÃèÊö¡£
3¡¢ ÎļþÃû¾¡Á¿²»ÄÜÌ«³¤£¬ÒÔ²»³¬¹ý20¸ö×ÖĸΪÒË¡£
4¡¢ ͼƬÎļþÃû¾¡Á¿ÃèÊöͼƬÄÚÈÝ·ÖÀà¡£¾¡Á¿ ......
¼Ù¶¨ÓÐÒ»¸öProduct±í£¬×Ö¶ÎÓУ¨Id,Name,Quantity,...£©½«QuantityÁÐÓÃtextbox¸ñʽÀ´ÏÔʾ£º
Ê×ÏÈÔÚGridviewÖУ¬QuantityÁÐÒÔTemplateFieldÏÔʾ£¬ÆäËûµÄÁÐÊôÐÔÉèΪֻ¶Á£¬°ÑÏÔʾ¸ñʽÉèΪTextBox
<asp:TemplateField HeaderText="Quantity">
<ItemTemplate>
&nbs ......
¼òµ¥¾ÍÏÂÔÚ.NET¿ª·¢ÍøÕ¾ÖÐÒýÓÃwebservice²¢ÇÒ·¢²¼µ½·þÎñÆ÷µÄ×ö·¨£¬ÕâÀï²»½ØͼÁË¡£
1¡¢ÔÚÍøÕ¾ÏîÄ¿ÉÏ£¬ÓÒ¼ü-->Ìí¼ÓwebÒýÓà £¬½«webÒýÓõĵØÖ·Õ³Ìù£¬ÀýÈç http://192.168.14.222:6666/IbeBaseWebServicePublicWeb/IbeJourneyOdd.asmx
2¡¢¸øwebserviceÆð±ðÃû£¬Ò²¾ÍÊÇÒÔºóÄãµ÷ÓõÄÃüÃû¿Õ¼ä ÀýÈçIbeJourneyOdd
ÕâÑùÔ ......
ÔÚweb¿ª·¢Öо³£»áÅöµ½cssÑùʽµÄÔËÓã¬ÎÒ¾ÍÔÚasp.netÖÐÔËÓÃÑùʽ½øÐÐÁË×ܽᣡ
1¡¢Ê¹ÓÃstyleÊôÐÔÉèÖÃÑùʽ
•
nʵÀý
•StyleÊôÐÔÉèÖÃ
<asp:TextBox ID="TextBox1" runat="server"
style="background-color:Red; font-size:15px">
</asp:TextBox>
2¡¢Ê¹ÓÃCssclassÊôÐÔÉèÖà ......
£¨Ò»£© ģ̬´°ÌåµÄ´¦Àí·½·¨
1 javascript Óï·¨£º
var returnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])
·Çģ̬´°Ì壺
vReturnValue = window.showModelessDialog(sURL [, vArguments] [,sFeatures])
²ÎÊý˵Ã÷£º
sURL£º±ØÑ¡²ÎÊý£¬ÀàÐÍ£º×Ö·û´®¡£ÓÃÀ´Ö¸¶¨¶Ô»°¿òÒªÏÔʾµÄÎĵµµÄURL¡£
vAr ......