Welcome Guest Search | Active Topics | Sign In | Register

How to create a custom column in code? Options
WS
Posted: Sunday, February 27, 2011 10:07:25 PM
Rank: Advanced Member
Groups: Member

Joined: 2/27/2011
Posts: 37
Hi,

my question is how to create a Custom Column with an Repeater control in code, code like as below:


EO.Web.CustomColumn myColumn = new EO.Web.CustomColumn();
...
... ???? here.... how to create a EditorTemplate and add a repeater control to it
...
GridView.Columns.Add(myColumn);



Your reply on this is much appreciated,

Thanks
eo_support
Posted: Monday, February 28, 2011 8:58:23 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
WS
Posted: Monday, February 28, 2011 9:47:24 PM
Rank: Advanced Member
Groups: Member

Joined: 2/27/2011
Posts: 37
Hi,

Thank you for your reply.

I have created a DropDownListTemplate class and implemented interface to bind data to the DropDownList, and now it shows up on gridview which is a good start, but I am wondering how to do selectedValue of dropdown list databind in EO.Web.GridView, because I can't cast EO.Web.Internal.b9 to Web.UI.GridViewRow,

Could you please give me any solutions on this?

Thanks
William

eo_support
Posted: Tuesday, March 1, 2011 7:37:56 AM
Rank: Administration
Groups: Administration

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

You don't need to cast anything. You will need to put in some JavaScript code to get or set a value from and to your drop down list. The Grid does not create a editor template (your DropDownList) for every cell. It creates a single one and reuse them for all cells.

You can take a look of this topic to see more details about custom column:

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

The only difference between your code and the sample code in the documentation is your drop down is created with server code, thus it will have a different ClientID. Everything else is the same.

Thanks!
WS
Posted: Tuesday, March 1, 2011 5:03:55 PM
Rank: Advanced Member
Groups: Member

Joined: 2/27/2011
Posts: 37
Thanks very much for your help, it now works!
eo_support
Posted: Tuesday, March 1, 2011 5:16:07 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Great. Glad that it works for you!
WS
Posted: Tuesday, March 1, 2011 5:21:12 PM
Rank: Advanced Member
Groups: Member

Joined: 2/27/2011
Posts: 37
Hi,

Thanks,

my next question is how to implement cell data update without click submit after editing?

Thanks in advance
William







eo_support
Posted: Tuesday, March 1, 2011 5:33:52 PM
Rank: Administration
Groups: Administration

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

There are various way to do it but it always come down to submitting the page. The basic rules are:

1. You need to submit the page one way or another. Just like a TextBox will not send the changes to the server side unless the page is submitted, the Grid will not send any changes to the server unless the page is submitted;

2. If you need to submit the page inside one of the Grid's client side event handler, you usually need to delay your code with setTimeout. For example, if you submit the page inside a GridColumn's ClientSideEndEdit handler, you can delay executing your code with setTimeout this way:

Code: JavaScript
setTimeout(function()
  {
     ....your code to submit the page....
  }, 10);


This is necessary so that the Grid can finish its "normal" flow first before you posting back the changes.

There are various ways to submit a page, none is really particularly related to the Grid. You can also use AJAX calls if needed. In addition, we have a ScriptEvent control that you may find easier to use. All those are available options. But in the end they all need to do the same thing a button does --- to submit the page. And as far as the Grid's concern, it handles everything the same way as if a button was used.

Thanks!

WS
Posted: Tuesday, March 1, 2011 5:48:56 PM
Rank: Advanced Member
Groups: Member

Joined: 2/27/2011
Posts: 37
Hi,

Thanks very much for your quick response, it's really appreciated!

I will do as you recommanded and I am almost there

Thanks again
William

William
WS
Posted: Tuesday, March 1, 2011 6:15:24 PM
Rank: Advanced Member
Groups: Member

Joined: 2/27/2011
Posts: 37
Hi,

Another question: how to display datetime with Date and Time on grid?

Thanks
William


eo_support
Posted: Tuesday, March 1, 2011 6:27:16 PM
Rank: Administration
Groups: Administration

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

Please make sure you check the sample and documentation first and see if there is already anything that fits your need, if you still have any specific question we will be happy to help. We try to be very responsive to our users but we still expect our user to go through the the sample and documentation first.

BTW: Please create a new thread for every different question. That way it is easier to track and search.

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.