asp:DropDownList ID="Drprow" runat="server" Width="99px"
onselectedindexchanged="Drprow_SelectedIndexChanged">
<asp:ListItem Value="0">请选择</asp:ListItem>
<asp:ListItem Value=" ">空格</asp:ListItem>
<asp:ListItem Value="\n">换行</asp:ListItem>
<asp:ListItem Value=",">逗号</asp:ListItem>
<asp:ListItem Value=";">分号</asp:ListItem>
<asp:ListItem Value="\r">回车</asp:ListItem>
<asp:ListItem Value="\t">Tab</asp:ListItem>
</asp:DropDownList>
后台接受\n值变成了\\n 我想直接获得\n有啥办法没?
<asp:ListItem Value="0">请选择</asp:ListItem>
<asp:ListItem Value=" ">空格</asp:ListItem>
<asp:ListItem Value="\n">换行</asp:ListItem>
<asp:ListItem Value=",">逗号</asp:ListItem>
<asp:ListItem Value=";">分号</asp:ListItem>
<asp:ListItem Value="\r">回车</asp:ListItem>
<asp:ListItem Value="\t">Tab</asp:ListItem>
</asp:DropDownList>
protected void Drprow_SelectedIndexChanged(object sender, EventArgs e)
{
string str = Drprow.SelectedValue;
Response.Write(str);
}
你没必要转义的,只是你调试的时候必然会出现\\n这样而已.这点你可以不去理会
string[] words = sline.Split(strDlter, StringSplitOptions.RemoveEmptyEntries);
strDlter 获得的是\\n 识别不了?
换成 <asp:ListItem Value="<br>">换行</asp:ListItem>吧