0
我真的很努力与JavaScript编程,需要帮助。使用Javascript在GridView中禁用DropDownList
我想禁用6下拉列表客户端在gridview内。下面是我目前的JavaScript,除了最后一行,我试图禁用下拉列表之一。我认为这个问题是因为下拉列表在gridview中,而java找不到它们。我如何找到它们?
<script>
function EnableAndColorButtons() {
document.getElementById('<%= Submit.ClientID %>').disabled = false;
document.getElementById('<%= Submit.ClientID %>').style.background = "Lime";
document.getElementById('<%= Submit.ClientID %>').style.borderColor = "Green";
document.getElementById('<%= Cancel.ClientID %>').disabled = false;
document.getElementById('<%= Cancel.ClientID %>').style.background = "lightcoral";
document.getElementById('<%= Cancel.ClientID %>').style.borderColor = "Red";
document.getElementById('<%= InfoLbl.ClientID %>').innerHTML = '(Continue to make changes or click submit if finished)';
document.getElementById('<%= MakeChangeslbl.ClientID %>').innerHTML = 'You must click "Submit Changes" or "Cancel Changes" above before making Assignment changes below!';
//The above is working, but the below is not probaly because the drop down lists are within gridview1
document.getElementById('<%= DropDownList1.ClientID %>').disabled = true;
}
</script>
我的GridView在下拉列表中位于看起来是这样的:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3" DataTextField="FullDetails" DataValueField="FullDetails" Font-Size="Medium" Height="50px" OnDataBinding="DropDownlist1_DataBinding1" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" Width="230px">
</asp:DropDownList>
尝试改变自动回假,并检查其是否工作,我相信你写的是工作,只是回传造成的JavaScript这里的问题 – Se0ng11
我需要的AutoPostBack为下拉列表的功能好好工作。我确实尝试将autopostback更改为false以进行测试,并且下拉列表未被禁用。 – DannyBoy
当时......认为这对某个人来说很容易...... – DannyBoy