Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Nickel Contributor
Posts: 143
Registered: ‎03-24-2009

How to manually set the column width and other annoyances

Hiya

 

I'm populating a grid and wanted to also resize the first two columns so they don't wrap their contents, so in my BR I passed the DataGrid as a param and then do this

 

grd.datasource = ..... (IList);

grd.databind();

 

 and then

 

System.Web.UI.WebControls.GridView grd2 = (System.Web.UI.WebControls.GridView)grd.NativeControl;

grd2.Columns[
0].ItemStyle.Width = new System.Web.UI.WebControls.Unit(2500,System.Web.UI.WebControls.UnitType.Pixel);

grd2.Columns[1].ItemStyle.Width = new System.Web.UI.WebControls.Unit(2500,System.Web.UI.WebControls.UnitType.Pixel);

 

But the columns keep sizing based on the Header length. Any ideas on how can I prevent that????

 

Annoyances:

I copied and pasted a button from one form to another. I received an error, I removed the button, It removed the script associated with it in the ORIGINAL FORM!!!!!!!

 

more to come.... Smiley Happy 

Nickel Contributor
Posts: 143
Registered: ‎03-24-2009

Re: How to manually set the column width and other annoyances

Anyone...? Anyone...? Buller...?
Highlighted
Employee
Posts: 75
Registered: ‎04-02-2009

Re: How to manually set the column width and other annoyances

Defect 1-73074 logged for the script issue where a button has been copied and pasted from one form to another, and the button is then removed from the secondary form.
Nickel Contributor
Posts: 143
Registered: ‎03-24-2009

Re: How to manually set the column width and other annoyances

BTW, it happens with any control that has a script associated!!!!

 

Thank you

Employee
Posts: 535
Registered: ‎03-30-2009

Re: How to manually set the column width and other annoyances

Hi Eugenio -

Sorry, this is a bit of a tangent but thought it is a relevant thread to discuss opinions.

 

You mention that you used a BR (Business Rule) to implement your solution by passing a reference to the grid, etc. into the BR.

 

 

I believe the guidance from the product is that BRs should not act on any U.I. and should be constrained to acting on the Entity, the Current User, and any other Entity objects.  U.I. logic should be implemented in CodeSnippets or in external assemblies. The objective being to achieve as clean as possible division between Data/Entity layer and U.I. layer.

 

I've always followed that separation. Eugenio, you have always done interesting and sophisticated customizations with all SLX products including the SLX Webclient so am very interested in your opinion and observations as well as anyone else following this thread.

 

 

Todd Hardin
SalesLogix Professional Services Group
Nickel Contributor
Posts: 143
Registered: ‎03-24-2009

Re: How to manually set the column width and other annoyances

Todd

 

I was discussing the same topic with RJLedger earlier this week. He mentioned that you the same thing.

 

The truth being the matter is I could have done it in the UI snippets, but then I had to copy (and maintain) 6 times the same code, as the same grid logic is used in 6 different tabs, being the only differences if the tab is under Account, Contact or Opportunity, the grid names, etc.

 

Being that said, following Ryan Farley's techniques of casting SLX Web Controls as their Web UI .NET counterpart you can actually process controls anywhere, from the snippets to the internal BRs, as long as you pass that object when you call the BR.

 

Although I recommend following whatever conventional standards have been adopted, I don't see any problems or restrictions (except for "Design Guidelines") as why you would not be able to pass any object into a BR and cast it as the Equivalent Web Control it represents.

 

And if we want to get really really picky about the separation between UI and BRs in the backend, all the UI development of the web client should have been done with JQuery, and using AJAX/SData to retrieve and store data. (JQuery has beautiful visual themes very easy to implement - for example, for starters you could have dialogs upon dialogs upon dialogs, plus a lot of stuff that you could never achieve using .NET web controls -

 

If I were able to request SAGE something to make the developing of forms a little better, that would be to be able to write JavaScript/JQuery directly on the Quick Forms, because once you have that ability, 80%-100% of the time you would not need to do .NET stuff to control UI (also avoiding a lot of post backs and refreshes, by making the UI to be more "chatty" using AJAX/SData and JQuery), but I think this was also discussed in another thread before, and apparently it has not been yet added to the product.

 

E

 

 

 

 

 

 

 

 

Employee
Posts: 535
Registered: ‎03-30-2009

Re: How to manually set the column width and other annoyances

I am a big fan of the JQuery/ExtJS/SData concept. Would be fantastic to see that happen.

 

For re-use of U.I. code, my current preferences are (in this order) :

  1. Use external assembly for form and control event handlers. Create helper classes and methods for re-used code.
  2. CodeSnippets - sneak helper classes and methods into the Form_OnLoad() event handler.
  3. In-line CS (obsolete) - create custom cs files with helper classes and methods, place in \App_Code folder

None of this is a direct argument against using an Entity BR of course, but for the time being I am going to see where I can get to without doing any U.I. manipulation in BRs.

 

Todd Hardin
SalesLogix Professional Services Group