Welcome Guest Search | Active Topics | Sign In | Register

Dropdownlist in a Grid Options
ITMA
Posted: Friday, September 10, 2010 8:38:03 AM
Rank: Advanced Member
Groups: Member

Joined: 6/23/2010
Posts: 48
Hi,

I'm working on a scheduler and grid combination. I have it almost together... However:

I'm not quiet sure how the dropdownlist should act. In my opinion it ought to show the "Text Value" and not the "Selected Value / Index Value".

The dropdowns return correct data to database and stays on the text value aftar it's selected. But on the postback it goes back to showing the custom field value that is the index value that the dropdown list ought to focus on.

I have really followed your example that I'm very impressed of, really smart and proper!

But unfortunately I'm in to something that i dont understand.

As the VB code loads correct data I asume that it is something in the HTML.

Pleas advise, I really appreciate your help!

Best Regards,

ITMA



<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SchedGrid.aspx.vb" Inherits="Grid_Default" %>
<%@ Register assembly="EO.Web" namespace="EO.Web" tagprefix="eo" %>

<!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">

<script type="text/javascript">

var g_curItemIndex = -1;

function on_HoursVars_begin_edit(cell) {
//Store the current item index so that we can use
//it later in on_product_change
g_curItemIndex = cell.getItemIndex();

//Get the current cell value. Unlike the previous
//sample, this sample displays "Product_Name", but
//actually stores "Product_No".
var v = cell.getValue();

//Set the drop down box's selectedIndex based on the
//current value. Each drop down item's "value" property
//contains the "Product_No".
var dropDownBox = document.getElementById("ddlHoursVars");
for (var i = 0; i < dropDownBox.options.length; i++) {
if (dropDownBox.options[i].value == v) {
dropDownBox.selectedIndex = i;
return;
}
}

//No match has been found, display the "Please Select" item
dropDownBox.selectedIndex = 0;
}

function on_HoursVars_end_edit(cell) {
var dropDownBox = document.getElementById("ddlHoursVars");
var selectedIndex = dropDownBox.selectedIndex;
return dropDownBox.options[selectedIndex].value;
}


//---------------------------------------------------------------------

function on_ActType_begin_edit(cell) {
g_curItemIndex = cell.getItemIndex();
var v = cell.getValue();
var dropDownBox = document.getElementById("ddlActType");
for (var i = 0; i < dropDownBox.options.length; i++) {
if (dropDownBox.options[i].value == v) {
dropDownBox.selectedIndex = i;
return;
}
}

dropDownBox.selectedIndex = 0;
}

function on_ActType_end_edit(cell) {
var dropDownBox = document.getElementById("ddlActType");
var selectedIndex = dropDownBox.selectedIndex;
return dropDownBox.options[selectedIndex].value;
}

//---------------------------------------------------------------------


function on_ActPlace_begin_edit(cell) {
g_curItemIndex = cell.getItemIndex();
var v = cell.getValue();
var dropDownBox = document.getElementById("ddlActPlace");
for (var i = 0; i < dropDownBox.options.length; i++) {
if (dropDownBox.options[i].value == v) {
dropDownBox.selectedIndex = i;
return;
}
}

dropDownBox.selectedIndex = 0;
}

function on_ActPlace_end_edit(cell) {
var dropDownBox = document.getElementById("ddlActPlace");
var selectedIndex = dropDownBox.selectedIndex;
return dropDownBox.options[selectedIndex].value;
}

//---------------------------------------------------------------------

</script>


<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<eo:CallbackPanel id="CallbackPanel1" runat="server" Height="230px"
Width="100%" Triggers="{ControlID:Button1;Parameter:},{ControlID:Grid1;Parameter:}"
AutoDisableContents="True" SafeGuardUpdate="False">

<eo:Grid id="Grid1" Width="100%" Height="180px" runat="server"
KeyField="SchedAct_ID" AllowColumnReorder="True"
ColumnHeaderDescImage="00050105" ColumnHeaderAscImage="00050104" FixedColumnCount="1"
GoToBoxVisible="True" GridLines="Both" BorderColor="#7F9DB9" GridLineColor="220, 223, 228"
ColumnHeaderDividerImage="00050103" Font-Names="Tahoma" Font-Size="8.75pt" BorderWidth="1px"
FullRowMode="False" Font-Bold="False" Font-Italic="False" Font-Overline="False"
Font-Strikeout="False" Font-Underline="False">
<FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;"></FooterStyle>
<ItemStyles>
<eo:GridItemStyleSet>
<CellStyle CssText="padding-left:8px;padding-top:2px;"></CellStyle>
<FixedColumnCellStyle CssText="border-right: #d6d2c2 1px solid; padding-right: 10px; border-top: #faf9f4 1px solid; border-left: #faf9f4 1px solid; border-bottom: #d6d2c2 1px solid; background-color: #ebeadb; text-align: right"></FixedColumnCellStyle>
</eo:GridItemStyleSet>
</ItemStyles>
<GoToBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; BORDER-LEFT: #7f9db9 1px solid; WIDTH: 40px; BORDER-BOTTOM: #7f9db9 1px solid"></GoToBoxStyle>
<ContentPaneStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;"></ContentPaneStyle>
<ColumnTemplates>
<eo:TextBoxColumn>
<TextBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8.75pt; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: Tahoma"></TextBoxStyle>
</eo:TextBoxColumn>
<eo:DateTimeColumn>
<DatePicker runat="server" DayHeaderFormat="FirstLetter" DayCellHeight="16" DisabledDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL"
OtherMonthDayVisible="True" DayCellWidth="19" TitleRightArrowImageUrl="DefaultSubMenuIcon"
ControlSkinID="None" SelectedDates="">
<DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid"></DayHoverStyle>
<TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;"></TitleStyle>
<DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid"></DayHeaderStyle>
<DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></DayStyle>
<SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></SelectedDayStyle>
<TitleArrowStyle CssText="cursor:hand"></TitleArrowStyle>
<TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid"></TodayStyle>
<PickerStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;font-family:Courier New;font-size:8pt;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;"></PickerStyle>
<OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></OtherMonthDayStyle>
<CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma"></CalendarStyle>
<DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></DisabledDayStyle>
<MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px"></MonthStyle>
</DatePicker>
</eo:DateTimeColumn>
</ColumnTemplates>
<Columns>
<eo:RowNumberColumn Width="40"></eo:RowNumberColumn>
<eo:DateTimeColumn HeaderText="Start" DataField="StartTime"
DataFormat="{0:yyyy-MM-dd H:mm}" Width="125" DataType="DateTime">
<DatePicker runat="server" ControlSkinID="None" DayCellHeight="60" DayCellWidth="80"
DayHeaderFormat="Full" DisabledDates=""
SelectedDates="" GridLineColor="207, 217, 227"
GridLineFrameVisible="False" GridLineVisible="True" TitleFormat="MMMM, yyyy"
TitleLeftArrowHtml="&amp;lt;" TitleRightArrowHtml="&amp;gt;"
PickerFormat="yyyy-MM-dd H:mm">
<PopupExpandEffect Type="GlideTopToBottom" />
<PopupCollapseEffect Type="GlideTopToBottom" />
<CalendarStyle CssText="border-right: #cfd9e3 1px solid; border-top: #cfd9e3 1px solid; font-size: 11px; border-left: #cfd9e3 1px solid; cursor: hand; border-bottom: #cfd9e3 1px solid; font-family: verdana; background-color: #eaeaea" />
<TitleStyle CssText="padding-right: 3px; padding-left: 3px; font-weight: bold; padding-bottom: 3px; color: white; padding-top: 3px; border-bottom: #cfd9e3 1px solid; background-color: #006699; font-size: 11px; font-family: verdana;" />
<DayHeaderStyle CssText="font-size: 11px; font-family: verdana;height: 17px" />
<DayStyle CssText="font-size: 11px; font-family: verdana;border-right: #eaeaea 1px solid; border-top: #eaeaea 1px solid; border-left: #eaeaea 1px solid; border-bottom: #eaeaea 1px solid; background-color: #eaeaea; text-align: right;" />
<DayHoverStyle CssText="font-size: 11px; font-family: verdana;background-color:#DADADA;border-bottom-color:#DADADA;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#DADADA;border-left-style:solid;border-left-width:1px;border-right-color:#DADADA;border-right-style:solid;border-right-width:1px;border-top-color:#DADADA;border-top-style:solid;border-top-width:1px;text-align:right;" />
</DatePicker>
</eo:DateTimeColumn>
<eo:CustomColumn DataField="HoursVars" DataFormat=""
ClientSideEndEdit="on_HoursVars_end_edit" ClientSideBeginEdit="on_HoursVars_begin_edit"
HeaderText="Tid" Width="75" >
<EditorTemplate>
<select id="ddlHoursVars" style="width:75px" onchange="">
<option>-Välj TID-</option>
<asp:Repeater Runat="server" ID="rptHoursVars">
<ItemTemplate>
<option value='<%#DataBinder.Eval(Container.DataItem, "HoursVars")%>'>
<%# DataBinder.Eval(Container.DataItem, "Time")%>
</option>
</ItemTemplate>
</asp:Repeater>
</select>
</EditorTemplate>
</eo:CustomColumn>
<eo:StaticColumn DataField="EndTime" DataFormat="{0:yyyy-MM-dd H:mm}"
HeaderText="Slut" Width="125" ReadOnly="True">
</eo:StaticColumn>
<eo:CustomColumn DataField="ActType_ID" DataFormat=""
ClientSideEndEdit="on_ActType_end_edit" ClientSideBeginEdit="on_ActType_begin_edit"
HeaderText="Aktivitet" Width="160">
<EditorTemplate>
<select id="ddlActType" style="width:160px" onchange="">
<option>-Välj AKTIVITET-</option>
<asp:Repeater Runat="server" ID="rptActType">
<ItemTemplate>
<option value='<%#DataBinder.Eval(Container.DataItem, "ActType_ID")%>'>
<%# DataBinder.Eval(Container.DataItem, "ActType")%>
</option>
</ItemTemplate>
</asp:Repeater>
</select>
</EditorTemplate>
</eo:CustomColumn>
<eo:ButtonColumn ButtonText="Typ" Width="40">
</eo:ButtonColumn>
<eo:CustomColumn DataField="ActPlace_ID" DataFormat=""
ClientSideEndEdit="on_ActPlace_end_edit" ClientSideBeginEdit="on_ActPlace_begin_edit"
HeaderText="Plats" Width="160">
<EditorTemplate>
<select id="ddlActPlace" style="width:160px" onchange="">
<option>-Välj PLATS-</option>
<asp:Repeater Runat="server" ID="rptActPlace">
<ItemTemplate>
<option value='<%#DataBinder.Eval(Container.DataItem, "ActPlace_ID")%>'>
<%# DataBinder.Eval(Container.DataItem, "ActPlaceName")%>
</option>
</ItemTemplate>
</asp:Repeater>
</select>
</EditorTemplate>
</eo:CustomColumn>
<eo:ButtonColumn ButtonText="Ny" Width="40">
</eo:ButtonColumn>
<eo:StaticColumn DataField="UpdateDate" DataFormat="{0:yyyy-MM-dd H:mm}"
HeaderText="Uppdaterad" ReadOnly="True" Width="125">
</eo:StaticColumn>
</Columns>
<ColumnHeaderStyle CssText="background-image:url('00050101');padding-left:8px;padding-top:3px;"></ColumnHeaderStyle>
</eo:Grid>

<asp:Panel id="panChanges" Width="400px" runat="server" Visible="False">Change Summary:<br/></asp:Panel>
<asp:Button id="Button1" Text="Post Back!" Runat="server" OnClick="Button1_Click"></asp:Button>
</eo:CallbackPanel>
</form>
</body>
</html>






Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports EO.Web

Partial Class Grid_Default
Inherits System.Web.UI.Page

Dim db As New ProductionDataContext
Dim myAppSubs1 As New AppSubs1

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

If Not CallbackPanel1.IsCallbackByMe Then
'Databinding Grid1
Dim GrdSource0 = From a In db.SchedulerActivityViews Select a Order By a.StartTime
Grid1.DataSource = GrdSource0
Grid1.DataBind()

'Prepares and sets data to listbox "ddlHoursVars" in column 2
Dim HoursVarsColumn As EO.Web.CustomColumn = CType(Grid1.Columns(2), EO.Web.CustomColumn)
Dim HoursVarsRepeater As Repeater = CType(HoursVarsColumn.EditorInstance.FindControl("rptHoursVars"), Repeater)
Dim TimeData = From a In db.SchedulerHoursVarsViews Where a.HoursVars > 0 Select a
HoursVarsRepeater.DataSource = TimeData
HoursVarsRepeater.DataBind()

'Prepares and sets data to listbox "ddlActType" in column 4
Dim ActTypeColumn As EO.Web.CustomColumn = CType(Grid1.Columns(4), EO.Web.CustomColumn)
Dim ActTypeRepeater As Repeater = CType(ActTypeColumn.EditorInstance.FindControl("rptActType"), Repeater)
Dim ActivityData = From a In db.SchedulerActTypeViews
Where a.Consultant_ID = CInt(Session("Consultant_ID0")) Select a
ActTypeRepeater.DataSource = ActivityData
ActTypeRepeater.DataBind()

'Prepares and sets data to listbox "ddlActPlace" in column 6
Dim ActPlaceColumn As EO.Web.CustomColumn = CType(Grid1.Columns(6), EO.Web.CustomColumn)
Dim ActPlaceRepeater As Repeater = CType(ActPlaceColumn.EditorInstance.FindControl("rptActPlace"), Repeater)
Dim ActivityPlace = From a In db.SchedulerActPlaceViews
Where a.Consultant_ID = CInt(Session("Consultant_ID0")) Select a
ActPlaceRepeater.DataSource = ActivityPlace
ActPlaceRepeater.DataBind()
End If
End Sub 'Page_Load


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
panChanges.Visible = True
saverun()
End Sub 'Button1_Click

Sub saverun()
Dim s As String = String.Empty
If Grid1.ChangedItems.Length = 0 Then
s += "No item has changed."
Else
Dim item As EO.Web.GridItem
For Each item In Grid1.ChangedItems
Dim cell As EO.Web.GridCell
For Each cell In item.Cells
If cell.Modified Then
'Dim [text] As String = String.Format("Cell Changed: Key = {0}, Field = {1}, New Value = {2}", item.Key, cell.Column.DataField, cell.Value)


Dim [text] As String = String.Format("UPDATE SchedulerActivity SET {1} = '{2}' WHERE SchedAct_ID = {0}", item.Key, cell.Column.DataField, cell.Value)
myAppSubs1.SQL_exec([text])



s += "<br />"
s += [text]
End If
Next cell
Next item
End If

Dim info As New Literal()
info.Text = s
panChanges.Controls.Add(info)
End Sub


End Class 'Demos_Grid_Features_Edit_Grid_Data___Excel_Style_Demo


eo_support
Posted: Friday, September 10, 2010 9:12:35 AM
Rank: Administration
Groups: Administration

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

Your code looks fine to us. The key about drop down is a much more generic concept that you would be responsible for almost everything inside a CustomColumn. The Grid stores the data for you and it can be a number/index or text. But that is totally up to you because your code (your begin_edit and end_end handlers) will be the ones that interpret this value. The Grid only holds this value to you and it does not do anything else. So I would suggest you to debug the begin_edit and end_edit handlers to see whether your handler has received the correct value first.

Thanks!
ITMA
Posted: Saturday, September 11, 2010 5:26:14 AM
Rank: Advanced Member
Groups: Member

Joined: 6/23/2010
Posts: 48
I Appreciate your answer that helped me one step further.

I had capital letters, and a miss match of number formats that caused the dropdownlist not linking to the grid. However, I'm still not successful in showing the ’text’/’text value’ of the dropdownlist that has a meaning to the user. What I see is the indexvalue of the dropdownlist, the value that now is linked to the customfield and what is not of a need or meaning to the user.

The CustomColumnField keeps one value per column. The listbox keeps two per row, one for the linkage and the second one for presentation, that is obvious. Also linking to the CustomField thanks to your advice of yesterday. Angel

I've realized that it might be because that I haven't declared a function as described in the documentation e.g. “ClientSideGetText="on_hoursvars_column_gettext".

When I try to sort this out I can’t find any examples that helps. Perhaps that is because this issue is so obvious that it isn’t necessary to have it there. Unfortunately to me, as I really don’t understand this straight forward solution compared to what I’m used to when using asp.net controls. d'oh!

There is a thread on this:
Earlier thread, but the outcome is uncertain to me.

I’m basing my efforts on your example:
Custom Column Advanced 2 , that is not mentioning the “ClientSideGetText”.

However in your documentation regarding CustomField it does, but leaves out the example javascript.

[ASPX]
<eo:Grid .....>
....
<Columns>
....
<eo:CustomColumn ClientSideOnGetText="on_column_gettext" ... />
</Columns>
....
</eo:Grid>



At the end

Am I on the correct path when I present a conclusion regarding the CustomColumn and a dropdownlist in it?

A CustomColumn:
- keeps one value eventually as an index linked to a dropdownlist as in my case,
- and if so, it is also necessary to have something executed by “ClientSideGetText” that actually shows the ‘text’/’text value’ from the dropdownlist that isn’t the index?
-So thereby it is three parts except of the dropdownlist, one when start editing, one when end editing, and also a third that overrides what actually are shown in the customfield.


Well, it is obvious that I’m a bit confused at the moment why I hope that it is something that you can help me sort out.



Best regards,

ITMA

eo_support
Posted: Saturday, September 11, 2010 7:55:43 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
ITMA wrote:
- keeps one value eventually as an index linked to a dropdownlist as in my case,

No. The statement is true for this sample only but not true for CustomColumn. This samples uses dropdown and index this way. It doesn't have to be this way. You can devise any other mechanism. It is totally up to you and has nothing to do with the Grid or CustomColumn in general.

ITMA wrote:
- and if so, it is also necessary to have something executed by “ClientSideGetText” that actually shows the ‘text’/’text value’ from the dropdownlist that isn’t the index?

Usually yes. ClientSideGetText is for you to render the Grid cell when the cell is in non-edit mode. CustomColumn's EditorTemplate (the drop down in your case) is for you to render the Grid cell when the cell is in edit mode. Usually you need both.

ITMA wrote:
-So thereby it is three parts except of the dropdownlist, one when start editing, one when end editing, and also a third that overrides what actually are shown in the customfield.

Exactly. The key is your begin edit and end edit function works together with whatever actually are shown (in this case a drop down) to edit a single value. The Grid doesn't care what type of value you are editing (string or index or whatever). It doesn't care what EditorTemplate you use (either drop down or button or textbox or whatever). The only thing it does is to hold the value for you and hand it over to you when you need to show (pass it to your ClientSideGetText) or edit it (pass it to your ClientSideBeginEdit). From there on everything is yous.

You can find some more information here:

http://doc.essentialobjects.com/library/1/grid/custom_column.aspx

The best way for you to understand how CustomColumn work is probably to forget about the dropdown list box and try to replace it with something else (for example, a simple textbox).

Hope this helps.

Thanks
ITMA
Posted: Saturday, September 11, 2010 9:04:26 AM
Rank: Advanced Member
Groups: Member

Joined: 6/23/2010
Posts: 48
OK / Thanks!!

One step further again. I really appreciate cooperating with essentialobjects. Since I started it has given my project a strong boost forward and improved the professionalism a lot. Maybe to level a bit over the edge of my development skills. But with training, patience and some effort it will be successful.

Therefore I will continue struggle and wish to express my gratitude to your excellent controls, good spirit and work.

As a new conclusion on this thread:
- If I wish to present another value in the “CustomColumn” than what the grid delivers that is OK by using a function called from “ClientSideOnGetTex”.
- To have that value presented I have to get it from another column in the grid that might be not visible.
- In that case I have to do it by referencing this another column in the grid from the “CustomColumn” by the Javascript function called from “ClientSideOnGetTex”.
- How to do that? Is it an easy example somewhere how to do it?
- Or am I on wrong approach / path here?


Again, Thanks!


ITMA
eo_support
Posted: Saturday, September 11, 2010 9:18:04 AM
Rank: Administration
Groups: Administration

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

We won't take whatever you are assigned to do and just do it for you by giving you an example. There are numerous business scenarios. We will only give you very general samples for a very specific feature, not for a particular business scenario. You will need to learn to understand that feature and adapt the sample to fit your need.

You can get any cell value from the Grid by using our Grid's client side API. You will want to start from here if you are not familiar with our client side API yet:

http://doc.essentialobjects.com/library/1/clientapi_howto.aspx

Thanks
ITMA
Posted: Saturday, September 11, 2010 12:03:37 PM
Rank: Advanced Member
Groups: Member

Joined: 6/23/2010
Posts: 48
OK!

I can see why and also understand why.

I’m grateful for your answers that have helped me a lot.

I’m now thru this topic and have finally a solution that I enclose below.


Thanks! Applause



ITMA






<script type="text/javascript">

function on_hoursvars_begin_edit(cell) {
a_curItemIndex = cell.getItemIndex();

//Get the current cell value. Unlike the previous
//sample, this sample displays "Product_Name", but
//actually stores "Product_No".
var v = cell.getValue();

//Set the drop down box's selectedIndex based on the
//current value. Each drop down item's "value" property
//contains the "Product_No".
var dropDownBox = document.getElementById("ddlhoursvars");
for (var i = 0; i < dropDownBox.options.length; i++) {
if (dropDownBox.options[i].value == v) {
dropDownBox.selectedIndex = i;

return;
}
}

//No match has been found, display the "Please Select" item
dropDownBox.selectedIndex = 0;
}

function on_hoursvars_end_edit(cell) {
//Get the new value from the drop down box
var dropDownBox = document.getElementById("ddlhoursvars");
var selectedIndex = dropDownBox.selectedIndex;
if (selectedIndex > 0)
return dropDownBox.options[selectedIndex].value;

return null;
}


function on_hoursvars_column_gettext(column, item, cellValue) {
//Gets values from a textcolumn that is hidden
var dropDownBox = document.getElementById("ddlhoursvars");
return column = item.getCell(9).getValue();
}

</script>

--------------------



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.