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.
|
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.aspxOnce 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.aspxHope this helps. Thanks!
|