asp.net C#怎么得到textbox选定的文本

asp.net C#如何得到textbox选定的文本RT比如说这是内容怎么得到选定的文本‘内容’?[解决办法]只能通过JS获

asp.net C#如何得到textbox选定的文本
RT
比如说这是内容
怎么得到选定的文本‘内容’?


[解决办法]
只能通过JS获取
后台要使用可AJAX来实现

JS代码
function getRangeById(id) 
{ 
var word=''; 
if (document.selection){o=document.selection.createRange();if(o.text.length>0)word=o.text;}else{ 
o=document.getElementById(id); p1=o.selectionStart;p2=o.selectionEnd; 
if (p1||p1=='0'){if(p1!=p2)word=o.value.substring(p1,p2);}} 
return word; 
}