一、读取和设置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.
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;
}
});