Visualization SPmenuField in SPGridView - sharepoint-2010

I have created SPGridView and added one SPMenuField as the first column and some BoundFields. Then I added MenuTemplate to the first column. But there are rectangles with white color border. I want to hide them. How can I do it ?
Here is the code I use:
SPMenuField colMenu = new SPMenuField();
colMenu.HeaderText = "Title";
colMenu.TextFields = "Title";
colMenu.MenuTemplateId = "TitleListMenu";
colMenu.NavigateUrlFields = "WebId, ListId, ID";
colMenu.NavigateUrlFormat = "default.aspx?WebID={0}&ListID={1}&ListItemID={2}";
colMenu.TokenNameAndValueFields = "Param1=ID";
colMenu.SortExpression = "Title";
MenuTemplate typeListMenu = new MenuTemplate();
typeListMenu.ID = "TitleListMenu";
// ... //
Controls.Add(typeListMenu);
customGridView.Columns.Add(colMenu);

Here is the answer on my question. It is nesseccery to narrow the .ms-menuimagecell css class.

Related

Oxyplot - LineAnnotion text display horizontally

I use C# and Oxyplot.
I have a LineAnnotation to which I want to add a text.
So I have set Text Property for the LineAnnotation, but the text is vertical aligned.
How could I add a text (1..3 lines) to a LineAnnotation and that texts shows horizontally, so that users can read it ?
Not good :
What I would like:
LineAnnotation Markerline = new LineAnnotation();
Markerline.Color = OxyColors.Blue;
Markerline.LineStyle = LineStyle.Solid;
Markerline.StrokeThickness = 5;
Markerline.Type = LineAnnotationType.Vertical;
Markerline.XAxisKey = "x1";
Markerline.YAxisKey = yAxisKey;
Markerline.Tag = "Marker";
Markerline.Text = "Hello World"; //how to display on top of Markerline horizontally ?
Just set the LineAnnotationType:
Markerline.Type = LineAnnotationType.Horizontal;
You need to LineAnnotation.TextOrientation property. For example,
Markerline.TextOrientation = AnnotationTextOrientation.Horizontal;
In addition, you could also set the LineAnnotation.TextHorizontalAlingment Property to dictate on the position of Text with respect to the Line Annotation.
Markerline.TextHorizontalAlignment = HorizontalAlignment.Left;

Remove space between name and percentage in pie chart legend (amcharts4)

I want to get rid of that space in the legend between the name and the percentage. In the pic, I have highlighted the space in yellow.
For example, I want the first legend item to be "Lithuania (30.5%)". That extra space between "Lithuania" and "30.5%" spoils my UI.
My code for the legend is the following:
// Add and configure Series
var pieSeries = chart.series.push(new am4charts.PieSeries());
pieSeries.dataFields.value = "litres";
pieSeries.dataFields.category = "country";
pieSeries.slices.template.stroke = am4core.color("#fff");
pieSeries.slices.template.strokeWidth = 2;
pieSeries.slices.template.strokeOpacity = 1;
pieSeries.ticks.template.disabled = true;
pieSeries.labels.template.disabled = true;
// This creates initial animation
pieSeries.hiddenState.properties.opacity = 1;
pieSeries.hiddenState.properties.endAngle = -90;
pieSeries.hiddenState.properties.startAngle = -90;
pieSeries.legendSettings.labelText = '{category}';
pieSeries.legendSettings.valueText = null;
pieSeries.labels.template.text = "{category}: {value}";
pieSeries.slices.template.tooltipText = "{category}: {value}";
chart.legend = new am4charts.Legend();
chart.legend.fontSize = 5;
chart.legend.markers.template.width = 5;
chart.legend.markers.template.height = 5;
What change must I make in order to get this done?
You can move the value to the "labelText":
pieSeries.legendSettings.labelText = "{category}: {value.percent.formatNumber('#.0')}%";
And disable value labels altogether:
chart.legend.valueLabels.template.disabled = true;

display data labels column stacked epplus

I have a stacked column report and i need to show the label value inside each of the series, is this possible. here is the code i have so far. It does look like barcharts have this option, not sure if i need to convert report to that type.
chart.Title.Text = "Total Pipeline - Initiative Count by Release";
chart.Title.Font.Size = 8;
chart.SetPosition(45, 0, 3, 0);
chart.SetSize(400, 300);
chart.Legend.Add();
chart.YAxis.MajorUnit = 10;
var series1 = chart.Series.Add(Chartsheet.Cells["L23:Q23"], Chartsheet.Cells["L22:Q22"]);
series1.HeaderAddress = new ExcelAddress("'Graphs'!K23");
var series2 = chart.Series.Add(Chartsheet.Cells["L24:Q24"], Chartsheet.Cells["L22:Q22"]);
series2.HeaderAddress = new ExcelAddress("'Graphs'!K24");
chart.Legend.Position = eLegendPosition.Bottom;
chart.YAxis.LabelPosition = eTickLabelPosition.NextTo;
chart.XAxis.MajorTickMark = eAxisTickMark.Out;
chart.XAxis.MinorTickMark = eAxisTickMark.None;
chart.ShowDataLabelsOverMaximum = true;
so i just forced a format of a barchart and i have the label option
var chart = (OfficeOpenXml.Drawing.Chart.ExcelBarChart) Chartsheet.Drawings.AddChart("chart", eChartType.ColumnStacked);

List view with tile view style, sub item does not appear?

I'm working on ListView with pure win32 api. But when I set ListView with tile view. then the sub item does not appear beside item.
My code below:
ListView_SetView(m_hwndListview,LV_VIEW_TILE);
//Set tile view info
SIZE size = { 150, 75 };
LVTILEVIEWINFO tileViewInfo = {0};
tileViewInfo.cbSize = sizeof(tileViewInfo);
tileViewInfo.dwFlags = LVTVIF_FIXEDSIZE;
tileViewInfo.dwMask = LVTVIM_COLUMNS | LVTVIM_TILESIZE;
tileViewInfo.cLines = 3;
tileViewInfo.sizeTile = size;
//Set tile info
LVTILEINFO lvti = {0};
int order[2];
order[0]=2;
order[1]=1;
lvti.cbSize = sizeof(LVTILEINFO);
lvti.iItem = 0;
lvti.cColumns = 2;
lvti.piColFmt = LVCFMT_LEFT;
lvti.puColumns = PUINT(order);
ListView_SetTileInfo(m_hwndListview, &lvti);
ListView_SetTileViewInfo(m_hwndListview, &tileViewInfo);
Does anyone have idea to solve this problem?
Thanks so much!
lvti.piColFmt should be a pointer to an array of column format values, not a single value. In your case it could be something like this:
int colfmt[2];
colfmt[0] = LVCFMT_LEFT;
colfmt[1] = LVCFMT_LEFT;
lvti.piColFmt = colfmt;
Hope that helps!

SharePoint get value of rich text box control created programatically

I'm writing a custom web part that need to use a couple of rich text box controls. I'm placing the controls onto the web part programatically. When the web part gets a save postback I'm able to capture the data from all the fields except the two rich text box ones. What's the trick to be able to get the value of a rich text box?
The code I"m using to place my form controls is:
private void CreateInputControls()
{
inputPanel.Controls.Clear();
SPList list = SPContext.Current.Site.RootWeb.Lists["MyList"];
SPContentType cType = list.ContentTypes[0];
Table table = new Table();
table.CellPadding = 3;
table.CellSpacing = 0;
SPContext newContext = SPContext.GetContext(System.Web.HttpContext.Current, list.DefaultView.ID, list.ID, list.ParentWeb);
foreach (SPField field in cType.Fields)
{
if (!field.Hidden && field.CanBeDisplayedInEditForm)
{
FieldLabel fieldLabel = new FieldLabel();
fieldLabel.ControlMode = SPControlMode.New;
fieldLabel.ListId = list.ID;
fieldLabel.FieldName = field.InternalName;
fieldLabel.ItemContext = newContext;
fieldLabel.RenderContext = newContext;
fieldLabel.Field.Required = fieldLabel.Field.Required;
FormField formField = new FormField();
formField.ControlMode = SPControlMode.New;
formField.ListId = list.ID;
formField.FieldName = field.InternalName;
formField.ItemContext = newContext;
formField.RenderContext = newContext;
formField.ID = field.InternalName;
formField.EnableViewState = true;
TableRow row = new TableRow();
table.Rows.Add(row);
TableCell cellLabel = new TableCell();
TableCell cellField = new TableCell();
cellLabel.Controls.Add(fieldLabel);
cellField.Controls.Add(formField);
row.Cells.Add(cellLabel);
row.Cells.Add(cellField);
}
}
inputPanel.Controls.Add(table);
}
The code I'm using to save a new item is:
private void UpdateItem(string bannerImageURL, string thumbnailImageURL)
{
SPList list = SPContext.Current.Site.RootWeb.Lists["MyList"];
SPContentType cType = list.ContentTypes[0];
SPItem item = list.AddItem();
foreach (SPField field in cType.Fields)
{
if (!field.Hidden && field.CanBeDisplayedInEditForm)
{
FormField formField = (FormField)inputPanel.FindControl(field.InternalName);
if (formField != null)
{
// Saves data for all fields EXCEPT for rich text box (sharepoint multiline columns).
item[field.Title] = formField.Value;
}
}
}
item.Update();
}
Maybe there's an issue with the field name. Try to use the InternalName.
item[field.InternalName] = formField.Value;
I have been struggling with this and am using a workaround which I thought I'd post as this was quite frustrating.
The problem is that the RTE control is rendered empty and then populated from a hidden control with JavaScript on the client. However this hidden control is accessible server side thus:
switch (formField.Field.Type)
{
case SPFieldType.Note:
var rtf = (RichTextField)formField.Controls[0];
item[field.Title] = rtf.HiddenInput.Value;
break;
default:
item[field.Title] = formField.Value;
break;
}
This may need extending for other field types but you get the idea...