ashx生成html的,.ashx内部读取和设置html元件的内容

一、读取和设置html内部元件的值

HTML:

//给客户端赋值

Document.Find("#_isExistBilling").First().SetAttribute("value", ViewData["IsEnable"].ConvertTo().ToString());

Document.Find("#_paymentOrderId").First().SetAttribute("value", paymentOrderId.ToString());

fp_paymentMethod.Find("#continue_pay").First().SetAttribute("href", Url.Action("Pay", "Payment", new { paymentOrderId = paymentOrderId }));

二、查找HTML内部元素值

HTML:

  • When you click continue, you will be redirected to the Paypal site to pay with your credit card as a Paypal guest.

    Payment Types:

  • When you click continue, you will be temporarily redirected to the Paypal site to log in and complete your order.

  • Payment Types:

  • WebMoney is available in all countries and supports currencies RUB,USD,EUR.

Please choose a payment method.

ashx代码:

--获取html内部元素的值

var fp_paymentMethod = Document.Find("#fp_paymentMethod").First();

fp_paymentMethod.Find("ul li").ToArray().ForAll(li =>

{

string paymentMethodValue = li.Find("input[name=paymentMethod]").First().Attribute("value").AttributeValue;

if (!paymentRequest.CandidatePaymentMethods.IsNullOrEmpty())

{

if (!paymentRequest.CandidatePaymentMethods.Contains(paymentMethodValue, StringComparer.OrdinalIgnoreCase))

{

li.Remove();

return;

}

}

//如果语种是俄罗斯语,去掉WebMoney支付方式

if (paymentRequest.LanguageCode.ToUpper() == "RU" && paymentMethodValue.ToLower() == "webmoney")

{

li.Remove();

return;

}

});



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值