传递参数有问题!在C#那边解决不了,来asp看看 链接地址http://bbs.csdn.net/topics/390377663?page=1#post-393784355帮忙看看一下哪里错了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这是我debug时 "#" + linkTypes 的值:#ctrl1_FLogoURLTextBox我发现$("#" + linkTypes).css("background", "Red");等都不行,也就是说无法对这个控件操纵。他解析引擎解析到浏览器的参数为:onchange="linkTypeChange(this,'ctrl1_FLogoURLTextBox')">崩溃。··· 1、jquery的函数:function linkTypeChange(src, linkTypes) { if ($(src).val() == "text") { $("#" + linkTypes).css("background", "Red"); } else if ($(src).val() == "pic") { $("#" + linkTypes).css("background", "Blue"); } }2、后台ItemCreated代码://插入或编辑时. if (e.Item.ItemType == ListViewItemType.DataItem || e.Item.ItemType == ListViewItemType.InsertItem) { //找到链接类型的DropDownList. DropDownList ddListLinkType = (DropDownList) e.Item.FindControl ("ddListLinkType"); //找到显示类型的logo地址的控件. TextBox FLogoURLTextBox = (TextBox) e.Item.FindControl ("FLogoURLTextBox"); if (ddListLinkType != null && FLogoURLTextBox != null) { ddListLinkType.Attributes["onchange"] = "linkTypeChange(this,'" + FLogoURLTextBox.ClientID + "')"; if (ddListLinkType.SelectedValue == "text") { //如果类型是文件,logo地址隐藏. FLogoURLTextBox.Style["display"] = "none"; //设置style而不是属性. } else if (ddListLinkType.SelectedValue == "pic") { //如果类型是图片,logo地址显示. FLogoURLTextBox.Style["display"] = ""; } else { throw new Exception ("未知"); } } }3、ListView中InsertTemplate中待隐藏的TextBox:<asp:DropDownList ID="ddListLinkType" ValidationGroup="edit" runat="server"><asp:ListItem Value="text">文本</asp:ListItem><asp:ListItem Value="pic">图片</asp:ListItem></asp:DropDownList><asp:TextBox ID="FLogoURLTextBox" runat="server" ValidationGroup="edit" Text='<%# Bind("FLogoURL") %>' />4.需求:DropDownList为“文本”时,隐藏TextBox(FLogoURLTextBox). 1、jquery方法:function linkTypeChange(src, linkTypes) {if ($(src).val() == "text") {$("#" + linkTypes).hide();} else if ($(src).val() == "pic") {$("#" + linkTypes).show();}}2、后台ItemCreated代码://插入或编辑时.if (e.Item.ItemType == ListViewItemType.DataItem || e.Item.ItemType == ListViewItemType.InsertItem) {//找到链接类型的DropDownList.DropDownList ddListLinkType = (DropDownList) e.Item.FindControl ("ddListLinkType");//找到显示类型的logo地址的控件.TextBox FLogoURLTextBox = (TextBox) e.Item.FindControl ("FLogoURLTextBox");if (ddListLinkType != null && FLogoURLTextBox != null) {ddListLinkType.Attributes["onchange"] = "linkTypeChange(this,'" + FLogoURLTextBox.ClientID + "')";if (ddListLinkType.SelectedValue == "text") { //如果类型是文件,logo地址隐藏.FLogoURLTextBox.Style["display"] = "none"; //设置style而不是属性.}else if (ddListLinkType.SelectedValue == "pic") { //如果类型是图片,logo地址显示.FLogoURLTextBox.Style["display"] = "";}else {throw new Exception ("未知");}}}3、ListView中InsertTemplate中待隐藏的TextBox:<asp:DropDownList ID="ddListLinkType" ValidationGroup="edit" runat="server"><asp:ListItem Value="text">文本</asp:ListItem><asp:ListItem Value="pic">图片</asp:ListItem></asp:DropDownList><asp:TextBox ID="FLogoURLTextBox" runat="server" ValidationGroup="edit" Text='<%# Bind("FLogoURL") %>' />4.需求:DropDownList为“文本”时,隐藏TextBox(FLogoURLTextBox). 害得我弄那么久,这你能信!这个代码是bug,被你说中了,在2008运行没有问题,在2010却是有问题! 但是我的代码是在VS写的哈,解析到浏览器的是asp引擎。其实这个bug也不是我发现的。是教程里面的! 求救啊,ASP.NET MVC传递参数发生错误。 隐藏标题栏 div css问题 父div怎么遮盖子div FCKeditor上传路径问题 急 急 急 数据库连接不上??? ASP.NET中如何点击一个按钮然后弹出一个WEB窗体? js隐藏域传值问题,谢谢! 关于GridView自带分页以及一些第三方分页控件的分页问题 为什么找不到类型或命名空间名称“SQLConnection Session保存在SQLServer中,在SQLServer创建时间不对 利用openOffice转pdf,本地运行成功了,部署至iis,转换不成功
#ctrl1_FLogoURLTextBox
我发现$("#" + linkTypes).css("background", "Red");等都不行,也就是说无法对这个控件操纵。
他解析引擎解析到浏览器的参数为:
onchange="linkTypeChange(this,'ctrl1_FLogoURLTextBox')">
崩溃。···
if ($(src).val() == "text") {
$("#" + linkTypes).css("background", "Red");
} else if ($(src).val() == "pic") {
$("#" + linkTypes).css("background", "Blue");
}
}
2、后台ItemCreated代码:
//插入或编辑时.
if (e.Item.ItemType == ListViewItemType.DataItem || e.Item.ItemType == ListViewItemType.InsertItem) {
//找到链接类型的DropDownList.
DropDownList ddListLinkType = (DropDownList) e.Item.FindControl ("ddListLinkType");
//找到显示类型的logo地址的控件.
TextBox FLogoURLTextBox = (TextBox) e.Item.FindControl ("FLogoURLTextBox"); if (ddListLinkType != null && FLogoURLTextBox != null) {
ddListLinkType.Attributes["onchange"] = "linkTypeChange(this,'" + FLogoURLTextBox.ClientID + "')"; if (ddListLinkType.SelectedValue == "text") { //如果类型是文件,logo地址隐藏.
FLogoURLTextBox.Style["display"] = "none"; //设置style而不是属性.
}
else if (ddListLinkType.SelectedValue == "pic") { //如果类型是图片,logo地址显示.
FLogoURLTextBox.Style["display"] = "";
}
else {
throw new Exception ("未知");
}
}
}
3、ListView中InsertTemplate中待隐藏的TextBox:
<asp:DropDownList ID="ddListLinkType" ValidationGroup="edit" runat="server">
<asp:ListItem Value="text">文本</asp:ListItem>
<asp:ListItem Value="pic">图片</asp:ListItem>
</asp:DropDownList><asp:TextBox ID="FLogoURLTextBox" runat="server" ValidationGroup="edit"
Text='<%# Bind("FLogoURL") %>' />
4.需求:DropDownList为“文本”时,隐藏TextBox(FLogoURLTextBox).
1、jquery方法:
function linkTypeChange(src, linkTypes) {
if ($(src).val() == "text") {
$("#" + linkTypes).hide();
} else if ($(src).val() == "pic") {
$("#" + linkTypes).show();
}
}
2、后台ItemCreated代码:
//插入或编辑时.
if (e.Item.ItemType == ListViewItemType.DataItem || e.Item.ItemType == ListViewItemType.InsertItem) {
//找到链接类型的DropDownList.
DropDownList ddListLinkType = (DropDownList) e.Item.FindControl ("ddListLinkType");
//找到显示类型的logo地址的控件.
TextBox FLogoURLTextBox = (TextBox) e.Item.FindControl ("FLogoURLTextBox");if (ddListLinkType != null && FLogoURLTextBox != null) {
ddListLinkType.Attributes["onchange"] = "linkTypeChange(this,'" + FLogoURLTextBox.ClientID + "')";if (ddListLinkType.SelectedValue == "text") { //如果类型是文件,logo地址隐藏.
FLogoURLTextBox.Style["display"] = "none"; //设置style而不是属性.
}
else if (ddListLinkType.SelectedValue == "pic") { //如果类型是图片,logo地址显示.
FLogoURLTextBox.Style["display"] = "";
}
else {
throw new Exception ("未知");
}
}
}
3、ListView中InsertTemplate中待隐藏的TextBox:
<asp:DropDownList ID="ddListLinkType" ValidationGroup="edit" runat="server">
<asp:ListItem Value="text">文本</asp:ListItem>
<asp:ListItem Value="pic">图片</asp:ListItem>
</asp:DropDownList><asp:TextBox ID="FLogoURLTextBox" runat="server" ValidationGroup="edit"
Text='<%# Bind("FLogoURL") %>' />
4.需求:DropDownList为“文本”时,隐藏TextBox(FLogoURLTextBox).
其实这个bug也不是我发现的。是教程里面的!