User Profile & Activity

Brad Loveall Member
Page
of 3
Posted: May 28, 2010 3:59 PM

Hi Andi,

Unless I'm just misunderstanding how this is used, I don't think that this will solve my problem either. What I need is to dynamically add various controls to a cell during the InitializeRow event but I won't know what all will be put in there. Here is an example:

If Not e.Row.Cells.GetNamedItem("FirstName") Is Nothing Then

Dim lbl As New Label("I want to add a label in this case")
Dim lt As New Literal("Maybe I also want to add a literal")
Dim ddl As New DropDownList()
ddl.Items.Add(New ListItem("I also want a dropdownlist"))

e.Row.Cells.GetNamedItem("Test").GetTemplateContainer().Controls.Add(lbl)
e.Row.Cells.GetNamedItem("Test").GetTemplateContainer().Controls.Add(lt)
e.Row.Cells.GetNamedItem("Test").GetTemplateContainer().Controls.Add(ddl)

End If

That is the sort of thing that I need to do. I want to add various server controls to a cell at run time but I don't know what sort of template can accomodate that. I wonder if perhaps I'm using the incorrect column type? Is there a way to accomplish what I am trying to do?

Thanks,

Brad

Posted: May 28, 2010 3:40 PM

Hi Handy,

I don't quite understand this example. I would have expected the GetCheckedRows method to return WebGridRow objects but instead, I get an arraylist of empty strings. I'm not sure what I can do with an arraylist of empty strings. Ultimately, I need to know which rows are checked and then I need to retrieve data from those rows. I don't know if I can accomplish that with this method. Am I overlooking something?

Brad

Posted: May 26, 2010 1:07 PM

Hi Andi,

Have you heard anything from your development team about this? It has been more than a week now.

Thanks,

Brad

Posted: May 26, 2010 10:38 AM

Actually, I was wrong. The code above does not work even if accept the default caching. Why would this be? Like I said, it works fine in normal situations - just not in "FlyPostBacks" where the grid has lost its cache.

Thanks,

Brad

Posted: May 20, 2010 12:29 PM

Thanks Andi, but in my case, I cannot just create a checkbox or a label in my template because I am adding controls dynamically. Sometimes I'm creating labels, sometimes checkboxes, sometimes maybe a combination of several controls will need to be added and it would be very time consuming to create a template for each of these scenarios. It seems that the blank template works ok though. I appreciate your help.

Brad

Posted: May 14, 2010 3:22 PM

Thanks Andi.

Can you give me some estimate as to when you suspect that you will hear back from the development team? Do you normally hear back in 24 hours or is it more common for it to take a week or two?

Thanks,

Brad

Posted: May 13, 2010 5:34 PM

Yudi,

I have tried that and it did not work. I actually downloaded his zip file, added it to the sample solution, and ran it and I got the same error. When I removed the xhtml doctype on this solution, it worked fine.

Brad

Posted: May 13, 2010 2:48 PM

Andi,

Has this issue been resolved? I downloaded your zip file from above and it did not work in IE7. We're having the exact same problem that others are having. Is there a workaround that actually works?

Posted: April 26, 2010 3:16 PM

Handy,

I was able to successfully implement your suggestion for the column move but I still am not sure how to prevent removal via the context menu.

You wrote that "If the current column is in "ColumnContextMenu...," but I'm not sure what that means. What is "ColumnContextMenu."

Also, what is the "NamedItem" that I should be searching for in instead of "mnuCol_checkbox1." I changed this to the name of the column in question but I got a javascript error.

Thanks,

Brad

Posted: April 23, 2010 3:46 PM

Thanks Handy. That is helpful.

All times are GMT -5. The time now is 12:51 AM.
Previous Next