Welcome Guest Search | Active Topics | Sign In | Register

Grid.CustomColumn DropDownList has repeated options Options
Joan Darling
Posted: Saturday, January 3, 2015 1:30:19 PM
Rank: Advanced Member
Groups: Member

Joined: 3/9/2010
Posts: 119
The following is the code I'm using. The code to load the receipts grid is not shown. The process is - when a gridItem is selected from the parent grid the receipts grid is loaded via a callback panel. Any ideas as to why this happens?



Code for receipts grid -

Code: Visual Basic.NET
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
    Dim creditaccount_column As EO.Web.CustomColumn = CType(gridReceipts.Columns(6), EO.Web.CustomColumn)
    Dim ddlcreditaccount_control As DropDownList = CType(creditaccount_column.EditorInstance.FindControl("ddlcreditaccount"), DropDownList)

    Dim ca_dt As Data.DataTable = selecteduser(selecteduser.GetKey(1)).CreditAccount.GetDataTable(True)
    With ddlcreditaccount_control
        .DataSource = ca_dt
        .DataTextField = "AcctName"
        .DataValueField = "AccountListID"
        .DataBind()
    End With
End Sub


Code: HTML/ASPX
<eo:CustomColumn 
    DataField="creditaccountname" 
    DataType="String" 
    HeaderText="Payment Method" 
    Width="150" 
    ClientSideBeginEdit="creditaccountClientSideBeginEdit"
    ClientSideEndEdit="creditaccountClientSideEndEdit">
    <EditorTemplate>
        <asp:DropDownList ID="ddlcreditaccount" runat="server"></asp:DropDownList>
    </EditorTemplate>
</eo:CustomColumn>


Code: JavaScript
function creditaccountClientSideBeginEdit(cell) {
    var text = cell.getValue();
    var value = "";

    var dropDownBox = document.getElementById(idprefix + "gridReceipts_edit_ctl03_ddlcreditaccount");

    for (x = 0; x < dropDownBox.options.length; x++) {
        if (dropDownBox.options[x].text == text) {
            value = dropDownBox.options[x].value;
        }
    }

    if (value.length == 0) {
        dropDownBox.selectedIndex = 0;
    } else {
        dropDownBox.value = value;
    }
}

function creditaccountClientSideEndEdit(cell) {
    var dropDownBox = document.getElementById(idprefix + "gridReceipts_edit_ctl03_ddlcreditaccount");
    var v = "";

    if (dropDownBox.selectedIndex > 0) {
        v = dropDownBox.options[dropDownBox.selectedIndex].text;
    } else {
        v = cell.getValue();
    }

    return v;
}
eo_support
Posted: Monday, January 5, 2015 6:53:59 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

I am not exactly sure what is wrong in your picture. If you meant that the items are repeating, you can try disable view state on your DropDownList to see if it helps.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.