I am going to change the css class for each option is selected. The input block size should be adjusted though changing the css class. I checked the condition(value pass) and sure it is correct. It should be be something wrong on the overwriting the css class. I tried target.CssClass = "xxx"
and Label lblEditor = (Label)e.Item.FindControl("lblEditor")
to change css class, seems that it is not work. How can I overwrite the old width here?
According the option have different size input box(background):
Now:
Target(Tune in F12 for test):
var selectoption = document.getElementById("<%= swapimgValue.ClientID %>");
var optionText = selectoption.options[selectoption.selectedIndex].text;
prompt("now reading", selectoption.selectedIndex); // check option
switch (selectoption.selectedIndex) {
case "8":
// document.getelementbyid("<%= labSponser.ClientID %>").CssClass = "previewLabel1_1";
// document.getelementbyid("<%= labProgram.ClientID %>").CssClass = "previewLabel1_1";
labSponser = (Label)e.Item.FindControl("labSponser");
labSponser.CssClass = "previewLabel1_1";
break;
case "9":
.......
}
// Css classes
span.previewLabel1 {
width: 610px;
verflow: hidden;
display:block;
}
/* -- Switch PTK length -- */
/* 1-9W */
span.previewLabel1_1 {
width: 330px;
overflow: hidden;
display:block;
}
/* 10-15W */
span.previewLabel1_2 {
width: 385px;
overflow: hidden;
display:block;
}
/* 16-19W */
/* 20-38W */
// Input boxs
<tr><td valign="top" class="style3"> <asp:Label ID="labSponser" runat="server" Text="" ForeColor="#076ADB" CssClass="previewLabel1"></asp:Label></td></tr>
<tr><td valign="top" height="8px"></td></tr>
<tr><td valign="bottom" height="40px"> <asp:Label ID="labProgram" runat="server" Text="" ForeColor="White" CssClass="previewLabel1"></asp:Label></td></tr>