SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I develop a Webpart, which should be deployed in other SP-Farms.
The Webpart contains a DataTable.
I deployed the solution and the DataTable appears in the right side of the Website.
I'm using a gridView and have some style-components like margin-right: 50px.

I understand that the Table appears in the right side of the Website, but is there a opportunity to get the Table only into the Webpart?

at the momemt

should be

I use a GridView and want to do the css here with the cssstylecollection. but it doesnt really work?


share|improve this question
Hi Grekko, I'm not sure what you are asking, to clarify could you possible post an image of your issue? I gave you 5 points for your post which should give you enough to post the image. – Hugh Wood Nov 28 '12 at 15:15
The DataTable should be in the WebPart no matter how big the size of the Screen or the browser is. – grekko Nov 28 '12 at 15:34
Hi Grekko, this looks like a CSS issue definitely. Are you able to go to and paste an example of the offending html there from the issue, and we can have a play and make it fit? – Hugh Wood Nov 28 '12 at 15:50
up vote 0 down vote accepted

hi can you please post your css, its all todo with the position element weather it relative or absolute, also set the display to block. So the two element should have the following css:



add this class to 12hive:

for me I have a master css class that add other css classes too it like for webparts using import directive.

@import url (/_Layouts/1033/styles/customfolder/webparts/thisIsTheCssFile.css);

but you can do the following:

protected override void CreateChildControls()

within the code where your creating your object you need to assign the cssclass class name to the control you want changing, so as an example:

    protected override void CreateChildControls()
       TreeView tv = new TreeView();
       tv.CssClass = "treeviewcss";

       DataTable dt = new DataTable();
       dt.CssClass = "datatable";

hope it helps :)

share|improve this answer
the float:left!important and Display:inline-block!important were very helpful. thanks. – grekko Dec 5 '12 at 14:22
your welcome! glad to be of some help – ali Sharepoint Dec 5 '12 at 14:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.