Webcombo unboun pupolate without postback

8 replies. Last post: February 17, 2013 8:48 PM by Handy Surya
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Amir AyaziMember

Hi,

i try to pupolate WebCombo unbound in Javascript without Postback

 

Scenario:

if length from Inputbox.value is 5 and my Array have more than 1 elemnts

 collapse div with ingrated WEBcombo and pupolate it with Array.

 

Problem:

Webcombo is pupolate with Elements 'undefined' and after click of webcombo-button is the button unvisible.

I have no idea what is wrong !

could you help me?

my code:

//Javascript from Allg_info.js

var arr1 = new Array(); function KeyPress(e, field) {

var oEvent = window.event ? window.event : e; if (field.value.length == 5) { CallMe("PLZ");

}

else {

displayDiv(0);

}

}

function CallMe(src) {

var ctrl = document.getElementById(src);  

PageMethods.XArray(ctrl.value, CallSuccess, CallFailed, arr1);

}

function CallSuccess(res, destCtrl) {

arr1 = res.slice(0);

if (arr1.length > 1) {

displayDiv(1);

var dest = document.getElementById("Ort");

}

else {

displayDiv(0);

}

}

// alert message on some failure

function CallFailed(res, destCtrl) {

alert(res.get_message());

}

//collapse DIV

function displayDiv(wert) {

var divstyle = new String(); divstyle = document.getElementById("div2").style.display; if (wert == 0) { document.getElementById("div2").style.display = "none";

}

else { document.getElementById("div2").style.display = "block";

}

}

function init() {

displayDiv(0);

}

function DoAddItem(controlId) {

var combo = ISGetObject("Ort");

 

for (i = 0; i <= arr1.length-1; i++)

{

var rows = combo.GetRows(); var newRow = combo.NewRow("X" + i); var Cells = newRow.GetCells(); Cells.GetNamedItem("Column0").Text = arr1[i];

rows.Add(newRow);

}

combo.UpdateUI();

return true;

}

//Javascript from Allg_info.js end

 

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="Preisrechner_2._Default" %> <%@ Register assembly="ISNet.WebUI.WebInput" namespace="ISNet.WebUI.WebControls" tagprefix="ISWebInput" %> <%@ Register assembly="ISNet.WebUI.WebCombo" namespace="ISNet.WebUI.WebCombo" tagprefix="ISWebCombo" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> <style type="text/css"> #form1

{

height: 361px;

}

.style1

{

width: 100%;

}

.style2

{

width: 81px;

}

.style3

{

width: 285px;

}

.style4

{

width: 80px;

}

.style5

{

width: 287px;

}

</style>

</head><

body onload="init()"> <script type="text/javascript" language="javascript" src="Allg_info.js"> </script> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"/> <div> <table class="style1"> <tr> <td class="style2">

PLZ:</td>

<td class="style3"> <asp:TextBox ID="PLZ" runat="server" onkeyup="KeyPress(event,PLZ);" onfocus="displayDiv(0);" Width="94px"></asp:TextBox> </td> <td> <ISWebInput:WebInput ID="WebInput1" runat="server"> </ISWebInput:WebInput> </td> </tr> </table> </div> <!-- nchste div---------------------> <div id="div2"> <table class="style1"> <tr> <td class="style4"> Ort:</td> <td class="style5"> <ISWebCombo:WebCombo ID="Ort" runat="server" UseDefaultStyle="true" AllowAutoPostback="True"> <LayoutSettings AllowAddItem="false" AllowFloatingText="false" AllowNavigationOnMouseWheel="true" AllowTextWrapping="false" AlwaysShowAllRowsOnDropdown="true" AlwaysShowColumnHeaders="false" AlwaysShowHelpButton="false" AlwaysShowResultBox="false" AlwaysShowSearchButton="true" AutoColumnOrdering="false" ComboMode="SingleColumn" EnableAnimation="true" EnableSlidingAnimation="true" EntryMode="AutoComplete" NoResultFoundAction="RevertSelection" SearchIconMode="Text" TextBoxMode="Editable"> </LayoutSettings> <Columns> <ISWebCombo:WebComboColumn BaseFieldName="Column0" Bound="False" HeaderText="Column0" Name="Column0" /> </Columns> <IntegrationSettings ControlId="Ort" /> </ISWebCombo:WebCombo> </td> <td> &nbsp;</td> </tr> </table>

</div>

</form>

</body>

</html>

 

VB Code:

<System.Web.Services.WebMethod()> Public Shared Function XArray(ByVal plz As String) As Array

'-----------------------code-----------------------

Return arr

End Function

 

 

 

 

All times are GMT -5. The time now is 11:11 PM.
Previous Next