Rank: Newbie Groups: Member
Joined: 2/13/2008 Posts: 5
|
Just a couple of questions for clarification on the Grid.
1) I reviewed the sample on how to use a dropdown in a Custom Column. However, I do not see an easy way to specify the listitems of the dropdwon at runtime from a database instead of specifying them directly in the HTML. I'm sure it's something I've simply overlooked.
2) My gird is set with an AllowNewItem="True" RunningMode="Client" FullRowMode="False" and has a DeleteCommandColumn on it. When I delete an existing row and then try to click in the AddNewItem row it doesn't work. It doesn't allow me to type anything or select those cells. Again, I'm hoping it is something easy.
Thanks for your help! -James
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi James, As for the first one you can just put an asp:DropDownList there instead of an HTML select element. Once you have it there, you will need to use something like this to populate the list:
Code: C#
//Get the column
EO.Web.CustomColumn column =
(EO.Web.CustomColumn)Grid1.Columns[index];
//Get the list box
DropDownList list =
(DropDownList)column.EditorInstance.FindControl("DropDownList1");
Now you can use list to dynamically add items to it. Note you will still need client side begin/end edit JavaScript function, and you may need to change ID parameter of the getElementById calls in those function because a server controls' ClientID is dynamically created. We are not sure about the second one, we will look into it and get back to you as soon as possible. Thanks
|
Rank: Newbie Groups: Member
Joined: 2/13/2008 Posts: 5
|
Thank you that helps, but I'm not sure how to call the code that you provided. Is the javascript supposed to somehow call a function in the codebehind that has this code? I think that's where I'm getting stumped...
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi,
No. You would usually call that in your Page_Load to fill up the DropDownList, just like you would fill up the Grid there. It has nothing to do with JavaScript. Note what we provided is only the first step of the data binding --- almost for every data binding you get the control and then populate it. When the control is directly placed in the form, you "get the control" by referencing its ID directly (such as "DropDownList1.DataBind()"), when the control is in a CustomColumn, you use the code we provided to get the control, then call its DataBind or whatever other methods/property to fill it up. The second step is the same, the first step is where it’s different.
Note this also means that the same list of options is for every cell in the column. So you can't really have option "A, B, C and D" for item A and option "X, Y, Z" for item B. That kind of flexibility is supported through begin_edit but is not built-in. This means you will have to come up with your own code to figure out what options should be there, regardless they come from your DB or some other source or out of blue. Basically the Grid calls begin_edit when you enters edit mode and you are free to do whatever you do like there.
Hope this helps. As you have confirmed, the second issue is fixed in build 2007.2.49.
Thanks
|
Rank: Newbie Groups: Member
Joined: 2/13/2008 Posts: 5
|
Thank you...that does help. Both my issues are resolved.
Thanks for you quick resposne!
-James
|