Hello guys. I have use Dropdownlist . I try change text in Dropdownlist , but i can not. Seem it losts some data .
i.e : in Dropdownlist i have three data: AREA1,AREA2,AREA3, it load from ajax .
<select id="cbo_area"></select>
function cb_area() {
$.ajax(
{
type: "POST",
url: "../BUS/WebService.asmx/LIST_AREA",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
$("#cbo_area").html('');
$.each($.parseJSON(data.d), function (idx, obj) {
$("#cbo_area").append(
'<option value="' + obj.AREA_ID + '">' + obj.AREA_NAME + '</option>');
});
},
error: function (data) {
alert("HTML Error Load Combo");
}
});
}
Ok, in my table , i click at row then click edit button, it will show data from row to Dropdownlist. it work but it only show one data , in this case "AREA2" (lost AREA1 and AREA3 in Dropdown) , i try click another row , i get that right , in this case "AREA3" (lost AREA1 nad AREA2 in Dropdown), etc...
$('#bt_edit').click(function (e) {
var DTO = {
'area_id': area_id_temp
};
$.ajax(
{
type: "POST",
url: "../BUS/WebService.asmx/AREA_NAME",
data: JSON.stringify(DTO),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
$("#cbo_area").html('');
$.each($.parseJSON(data.d), function (idx, obj) {
$("#cbo_area").append(
'<option value="' + obj.AREA_ID + '">' + obj.AREA_NAME + '</option>');
});
},
error: function (data) {
alert("HTML Error Load Edit");
}
});
});
I want to click a row in table , Dropdownlist will change text from row and concurrent with fields remaining data. i.e : when i click a row have "AREA1" , Dropdownlist text will change "AREA1" and more "AREA2" , "AREA3". Please give me some advice about this .
As I said above, I can load data into dropdownlist via cb_area function. I want to click on the row in the tables, data dropdownlist will change and additional the remaining fields.
Example: Dropdownlist alway have three text data : AREA1, AREA2, AREA3.
My table
1 ABC 123 AREA1
2 EFG 456 AREA2
3 IJK 789 AREA1
4 EFG 011 AREA3
I will click a row 2 , then click edit button . In here text in dropdownlist need to change AREA2, AREA1,AREA3 . , If i click a row 4, then click edit button, text in dropdownlist need to change AREA3,AREA1,AREA2 ,...etc
This means that text in dropdownlist will change according to the data of the line on the table, besides it must also other data
Best Regards.
Thank you.