Welcome Guest Search | Active Topics | Sign In | Register

ComboBox In Grid Options
Basit
Posted: Sunday, September 25, 2011 3:06:20 AM
Rank: Newbie
Groups: Member

Joined: 9/24/2011
Posts: 9
Dear Sir,

I already Add a combo box in a grid. The Combo box showed in the grid with the help of following code.

function on_product_change()
{
if (g_curItemIndex >= 0)
{
var grid = eo_GetObject("Grid1");
grid.raiseItemCommandEvent(g_curItemIndex, "SelectProduct");
}
}

<EditorTemplate>
<select id="product_dropdown" style="width:300px" onchange="on_product_change()">
<option>-Please Select-</option>
<asp:Repeater Runat="server" ID="Item">
<ItemTemplate>
<option value='<%#DataBinder.Eval(Container.DataItem, "Emp_No")%>'>
<%--<option><%#DataBinder.Eval(Container.DataItem, "Emp_Name")%></option>--%>
</option>
</ItemTemplate>
</asp:Repeater>
</select></EditorTemplate>

But how I save the Pk number in a database. The below code is the database.
cmd.Parameters.AddWithValue("Emp_No", Grid1.Items(i).Cells(2).Value)

What I want is to show employee name and save in a database Emp_No. Please help on that.

Thanks A lot.
Basit.
eo_support
Posted: Monday, September 26, 2011 8:03:58 AM
Rank: Administration
Groups: Administration

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

Our grid does not work that way. The EditorTemplate is only created once for the whole Grid (instead of one instance for each row). So you can not use data binding expression to bind it to a field. Further more, you must write the code to pass the value in/out of your EditorTemplate from/to the Grid. See here for more details:

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

Once you are done that, you would then examine the Grid's AddedItems/ChangedItems in your server side code to write the changes back to your database. See here for more details:

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

Hope this 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.