问题描述
这是后台load事件里的path值是json串protectedvoidPage_Load(objectsender,EventArgse){if(!string.IsNullOrEmpty(Request.Form["value"])){stringbackString=string.Empty;BF_GJPT_WebService.BF_GJPT_WebServiceBF=newBF_GJPT_WebService.BF_GJPT_WebService();stringstr=Request.Form["value"];str=str.Replace("n","r");stringpath=BF.GetHtml(str);前台是一个datagrid怎么把这个path值绑定到datagrid呢?
解决方案
解决方案二:
"{"Type":1,"List":[{"ID":"MAzqK2RqtCg=","Provider":"lotus2014","ProviderName":"","TicketType":"C","ChangePnr":"D","AgentRate":0.0,"RewardRate":6.0,"AddMoney":0.0,"Integral":0,"AutoTicket":false,"Advantages":false,"IntegralSign":false,"WorkTime":"09:00-18:15","IsWorking":true,"ServiceRegulation":"","Remark":"[票本类型]:境外电子<br/>[混舱]:允许1/2RT<br/>[儿童票]:奖励与成人一致<br/>[婴儿票]:婴儿不可开<br/>[无奖励]:留学生、劳工、海员、青年、老年、探亲、SPA、代码共享航班、三方协议、套票、整团、小团、<br/>需供应商审核,<br/>[其他备注]:境外Eterm出票,面价与民航系统有一定区别,请在支付前仔细检查。不提供行程单。<br/>","OutwardTrips":null,"ReturnTrips":null,"AdtPrice":6100.0,"AdtQPoint":0.0,"AdtTax":325.0,"ChdPrice":0.0,"ChdQPoint":0.0,"ChdTax":0.0,"InfPrice":0.0,"InfQPoint":0.0,"InfTax":0.0,"Type":0,"AdtNetPrice":6059,"AdtProfit":366,"ChdNetPrice":0,"ChdProfit":0,"InfNetPrice":0,"InfProfit":0},{"ID":"K31F+bRnS6g=","Provider":"guoji_mg","ProviderName":"","TicketType":"A","ChangePnr":"D","AgentRate":3.0,"RewardRate":2.2,"AddMoney":0.0,"Integral":0,"AutoTicket":false,"Advantages":false,"IntegralSign":false,"WorkTime":"09:00-20:00","IsWorking":true,"ServiceRegulation":"","Remark":"[票本类型]:BSP、<br/>[混舱]:允许1/2RT<br/>[儿童票]:奖励与成人一致<br/>[婴儿票]:婴儿不可开<br/>[无奖励]:留学生、劳工、海员、青年、探亲、OPEN、SPA、Q值、代码共享航班、三方协议、套票、整团、<br/>[其他备注]:SPA需审核<br/>","OutwardTrips":null,"ReturnTrips":null,"AdtPrice":6100.0,"AdtQPoint":0.0,"AdtTax":325.0,"ChdPrice":0.0,"ChdQPoint":0.0,"ChdTax":0.0,"InfPrice":0.0,"InfQPoint":0.0,"InfTax":0.0,"Type":0,"AdtNetPrice":6112,"AdtProfit":313,"ChdNetPrice":0,"ChdProfit":0,"InfNetPrice":0,"InfProfit":0},{"ID":"Gi3UoTdPoXY=","Provider":"guoji_mg","ProviderName":"","TicketType":"A","ChangePnr":"D","AgentRate":3.0,"RewardRate":2.1,"AddMoney":0.0,"Integral":0,"AutoTicket":false,"Advantages":false,"IntegralSign":false,"WorkTime":"09:00-20:00","IsWorking":true,"ServiceRegulation":"","Remark":"[票本类型]:BSP、<br/>[混舱]:允许1/2RT<br/>[儿童票]:奖励与成人一致<br/>[婴儿票]:婴儿不可开<br/>[无奖励]:留学生、劳工、海员、青年、探亲、OPEN、SPA、Q值、代码共享航班、三方协议、套票、整团、<br/>[其他备注]:SPA需审核<br/>"这是path中的一部分还有好多的
解决方案三:
兄弟,这代码太乱了。代码是否放在代码框里。
解决方案四:
引用2楼nongfuxu的回复:
兄弟,这代码太乱了。代码是否放在代码框里。
这是json串
解决方案五:
解析json,把解析后的数据组织到数据集里
解决方案六:
大家能不能直接写个详细的代码??我新手你们说的我哪里懂??
解决方案七:
引用5楼ly94331的回复:
大家能不能直接写个详细的代码??我新手你们说的我哪里懂??
定义合适的类,然后对json进行反序列化,方法网上去找,别老指望现成代码,做到不会可以来问
解决方案八:
话说,你怎么获取这个json的,不是你自己转的?转成json,再转回来,不会的话,上网查查
解决方案九:
编辑绑定ListView控件中的图片protectedvoidPage_Load(objectsender,EventArgse){stringsqlstr="select*fromtb_inf";//选择要绑定的数据库中的数据表sqlcon=newSqlConnection(strCon);//建立连接SqlDataAdapterda=newSqlDataAdapter(sqlstr,sqlcon);//创建适配器对象DataSetds=newDataSet();//创建数据集对象sqlcon.Open();//打开连接da.Fill(ds);//装载sqlcon.Close();//关闭连接this.GridView1.DataSource=ds;this.GridView1.DataKeyNames=newstring[]{"id"};this.GridView1.DataBind();//绑定控件显示数据}