我想檢查元素的內部html是否爲空,但我想在服務器端進行驗證,我將HTML視爲串。下面是一個使用此行
$('.spanArea').text() // what is the equivalent of this line in c#
我會知道,如果沒有.spanArea真的有東西在UI或不顯示我的代碼
public string HasContent(string htmlString){
// this is the expected value of the htmlString
// <span class="spanArea">
// <STYLE>.ExternalClass234B6D3CB6ED46EEB13945B1427AA47{;}</STYLE>
// </span>
// From this jquery code-------------->
// if($('.spanArea').text().length>0){
//
// }
// <------------------
// I wanted to convert the jquery statement above into c# code.
/// c# code goes here
return htmlSTring;
}
。我想在服務器端進行檢查。無需擔心如何設法訪問我已經被照顧的DOM。考慮將htmlString作爲Html字符串。
我的問題是,如果有任何相當於這個jquery行在C#中?
在此先感謝! :)
spanArea.InnerText? – Anuraj 2011-02-15 11:42:50
是的,我想檢查spanArea的內部文本是否在c代碼後面不是空的# – 2011-02-15 11:45:22
請將代碼放在服務於您的AJAX調用的頁面後面。 – Lazarus 2011-02-15 12:16:14