i have assigned the value to the label from data table ,the value of label is shown when i checked using break point.But it not shown in the browser
if(loadingHubArrivalTable.Rows.Count > 0 && dt != Convert.ToDateTime("1900-01-01"))
{
//ReferenceLabel.Text = loadingHubArrivalAdapter.SelectReferenceNumber(Convert.ToInt32(VehicleDropDownList.SelectedValue)).ToString();
ReferenceLabel.Text = loadingHubArrivalTable.Rows[0]["ReferenceNumber"].ToString();
VehicleNumberLabel.Text = VehicleDropDownList.SelectedItem.Text;
//loadingHubArrivalTable.Rows[0]["VehicleNumber"].ToString();
ObjectDataSource1.Select();
CheckBoxList.DataBind();
}
Related
With the following typoscript I get all content from the subpages on one page:
lib.allPid = COA
lib.allPid {
10 = HMENU
10 {
special = directory
special.value = 2
1 = TMENU
1 {
expAll = 1
NO.doNotShowLink = 1
NO.allStdWrap.field = uid
NO.allStdWrap.wrap = |,
}
2 < .1
}
}
lib.allContent = CONTENT
lib.allContent {
table = tt_content
select {
pidInList.cObject < lib.allPid
leftjoin = pages ON (tt_content.pid = pages.uid)
where = tt_content.colPos = 0
orderBy = pages.sorting ASC
}
}
But its not copying the tt_content wrap defined by the layout selectbox in the content element:
tt_content.stdWrap.innerWrap.cObject.default.20.40 = CASE
tt_content.stdWrap.innerWrap.cObject.default.20.40 {
key.field = layout
1 = TEXT
1.value = tag-1
2 = TEXT
2.value = tag-2
3 = TEXT
3.value = tag-3
4 = TEXT
4.value = tag-4
5 = TEXT
5.value = tag-5
6 = TEXT
6.value = tag-6
7 = TEXT
7.value = tag-7
}
I tried to add the wrap to the lib.allContent element like this, but it didn't work:
lib.allContent.stdWrap.innerWrap.cObject.default.20.40 = CASE
lib.allContent.stdWrap.innerWrap.cObject.default.20.40 {
key.field = layout
1 = TEXT
1.value = tag-1
2 = TEXT
2.value = tag-2
3 = TEXT
3.value = tag-3
4 = TEXT
4.value = tag-4
5 = TEXT
5.value = tag-5
6 = TEXT
6.value = tag-6
7 = TEXT
7.value = tag-7
}
Does anybody know how to do this? Thanks in advance!
EDIT:
I found a solution (or better: workaround) without typoscript. I insert the contents from the subpages with "New content element - Special Elements - Insert Record" manually one by one. Then, everything is copied. This solutions requires a little more user input but fits perfectly to my needs.
give a try to vhs ViewHelper it'll give you exact output what you want I mean default wrap and at all.
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<v:page.menu pageUid="2" includeSpacers="0" resolveExclude="1">
<f:for each="{menu}" as="contentList" iteration="Iteration">
<div id="uid{contentList.uid}" class="inner-page-content-of-pageUid-2">
<v:content.render column="0" pageUid="{contentList.uid}" />
</div>
</f:for>
</v:page.menu>
something more about vhs ViewHelper
I have an aspx(devexpress) grid. Using which I generate columns dynamically from code behind.Below is the code from my grid_databinding event.
GridViewDataTextColumn bfield = new GridViewDataTextColumn();
if (TestString.YearSelectedNames.ToString().Length > 4)
{ string colName = string.Empty;
if (iCount % 2 == 0)
{
colName = TestString.YearSelectedNames.ToString().Substring(5, 4) + "-" + dtFreezing.Columns[iCount].ColumnName.ToString();
bfield.HeaderTemplate = new DevxGridViewTemplate(ListItemType.Header, typeof(Label), colName, iCount);
}
else
{
colName = TestString.YearSelectedNames.ToString().Substring(0, 4) + "-" + dtFreezing.Columns[iCount].ColumnName.ToString().Replace('1', ' ');
bfield.HeaderTemplate = new DevxGridViewTemplate(ListItemType.Header, typeof(Label), colName, iCount);
}
}
else
{
bfield.HeaderTemplate = new DevxGridViewTemplate(ListItemType.Header, typeof(Label), dtFreezing.Columns[iCount].ColumnName.Trim(), iCount);
}
bfield.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
bfield.HeaderStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;
bfield.Name = dtFreezing.Columns[iCount].ColumnName.Trim();
bfield.Width = Unit.Pixel(120);
bfield.VisibleIndex = iCount;
bfield.DataItemTemplate = new DevxGridViewTemplate(ListItemType.Item, typeof(Label), dtFreezing.Columns[iCount].ColumnName.Trim(), iCount);
bfield.CellStyle.HorizontalAlign = HorizontalAlign.Right;
bfield.PropertiesTextEdit.DisplayFormatString = "N2";
gridViewProductCrop.Columns.Add(bfield);
Here the line of code
bfield.PropertiesTextEdit.DisplayFormatString = "N2";
is where I am trying to set the property of the grids' column to display only two decimals after the decimal point.
This line of code doesn't seem to work in the first place.
I have even tried using "{0:0.00}" and "{0:N2}" but in vain
Possible reason being that I am writing this line of code in the grid's databinding event. But how else can I set the column properties from code behind
Try to change this code
bfield.PropertiesTextEdit.DisplayFormatString = "N2";
to
this.PropertiesTextEdit.DisplayFormatString = "N2";
i think this happen coz u loop the object(make a new object) and the properties would be overwrite.
CMIIW
I have a SQL output like
TotalLeave Status
---------- ------
3 PaidLeave
5 MedicalLave
and I need to show this value in my label controls like,
lblMedicalLeave.text = 5
lblPaidLeave.text = 3
for this I just created objects for my dataset in my code like,
StaffAttendanceStatusTableAdapters.StaffTypesTableAdapter staffAttendanceStatus =
new StaffAttendanceStatusTableAdapters.StaffTypesTableAdapter();
StaffAttendanceStatus.StaffTypesDataTable StaffDataTable =
staffAttendanceStatus.GetDataStaffAttendanceStatus(staff.StaffId);
if (StaffDataTable[0] != null)
{
StaffAttendanceStatus.StaffTypesRow StaffRow = StaffDataTable[0];
lblTotalMedicalLeave.Text = StaffRow.TotalLeave.ToString();
lblTotalPaidLeave.Text = StaffRow.TotalLeave.ToString();
}
its showing the same value(3), is it possible to get the TotalLeave value for corresponding Status? can anyone help me here
You are accessing the same row both times. Use StaffDataTable[1] to access the second row. Anyway you should check if there is a result before access any values!
using StaffAttendanceStatusTableAdapters;
....
StaffTypesTableAdapter staffAttendanceStatus = new StaffTypesTableAdapter();
StaffAttendanceStatus.StaffTypesDataTable StaffDataTable =
staffAttendanceStatus.GetDataStaffAttendanceStatus(staff.StaffId);
if (StaffDataTable != null && StaffDataTable.Count > 1)
{
lblTotalMedicalLeave.Text = StaffDataTable[0].TotalLeave.ToString();
lblTotalPaidLeave.Text = StaffDataTable[1].TotalLeave.ToString();
}
hth
Since you need to get TotalLeave from two rows, you need to fetch data from two rows.
if (StaffDataTable != null && StaffDataTable.Rows.Count > 1)
{
StaffAttendanceStatus.StaffTypesRow StaffRow1 = StaffDataTable[0];
StaffAttendanceStatus.StaffTypesRow StaffRow2 = StaffDataTable[1];
lblTotalMedicalLeave.Text = StaffRow1.TotalLeave.ToString();
lblTotalPaidLeave.Text = StaffRow2.TotalLeave.ToString();
}
if there is no order of PaidLeave and MedicalLave status, just check row.Status and assign total value to corresponding label
I have a radchart that is supposed to display two lines with separate Y values, but when it loads it displays two lines, but they both have Y values that they are supposed to display and the Y values of the other line in the chart
ie:
(Data set 1: 1,2,6,9)
(Data set 2: 1,4,6,7)
(Lines display like: 1-1-2-4-6-6-9-7 and 1-1-2-4-6-6-9-7)
my series mapping looks like this:
<telerik:SeriesMapping LegendLabel="Line Series 1" >
<telerik:SeriesMapping.SeriesDefinition>
<telerik:StackedLineSeriesDefinition />
</telerik:SeriesMapping.SeriesDefinition>
<telerik:ItemMapping FieldName="LineYValue" DataPointMember="YValue" />
</telerik:SeriesMapping>
<telerik:SeriesMapping LegendLabel="Line Series 2" >
<telerik:SeriesMapping.SeriesDefinition>
<telerik:StackedLineSeriesDefinition />
</telerik:SeriesMapping.SeriesDefinition>
<telerik:ItemMapping FieldName="LineYValue" DataPointMember="YValue" />
</telerik:SeriesMapping>
</telerik:RadChart.SeriesMappings>
and in my ViewModel I have the data loaded like so
if (salesAndQtyByHour != null)
{
STUFF.ChartModels.Charts tempChart1 = new ODA.ChartModels.Charts() { ChartTitle = "Sales And Quantity By Hour" };
foreach (var item in salesAndQtyByHour)
{
tempChart1.myCharts.Add(new STUFF.ChartModels.Chart() { LineName = "Quantity", LineXValue = item.MilitaryTime, LineYValue = item.QtyOfItems });
tempChart1.myCharts.Add(new STUFF.ChartModels.Chart() { LineName = "Basket", LineXValue = item.MilitaryTime, LineYValue = item.Basket });
}
SalesAndQtyByHour = tempChart1;
}
I'm pretty sure its the CollectionIndex, but I'm not sure how to implement it in my case, I'm relatively new to this job.
Any help would be appreciated.
There is ItemsSource property of the SeriesMapping object. You can send each individual dataset to the corresponding SeriesMapping. Article:
http://www.telerik.com/help/silverlight/radchart-populating-with-data-series-mapping-items-source.html
I have an ObjectDataSource with an ID of ObjectDataSource1 on a webpage. I also have a gridview in which I am binding the ObjectDataSource.ID to the GridView.DataSourceID. The problem I get is when text is changed in a textbox, the code calls BrokerageTransactions.GetAllWithDt which returns a DataTable. I want to set this datatable as the DataSource for the GridView, but it is telling me that I can't set the DataSouce and DataSourceId together. How can I fix this? Code is below. Also. Why can't you set a DataSourceID and a DataSource when using an ObjectDataSource?
Thanks,
X
protected void BrokerageChange(Object sender, EventArgs e)
{
BrokerageTransactions brokerageaccountdetails =
new BrokerageTransactions();
DataSet ds = BrokerageAccount.GetBrkID2(new
Guid(Membership.GetUser().ProviderUserKey.ToString()),
ddlBrokerageDetails.SelectedItem.Text.ToString());
foreach (DataRow dr in ds.Tables[0].Rows)
{
brokerageaccountdetails.BrokerageId =
new Guid(dr["BrkrgId"].ToString());
}
ddlBrokerageDetails.SelectedItem.Value =
brokerageaccountdetails.BrokerageId.ToString();
if (txtTransactionsTo.Text != ""
&& txtTransactionsFrom.Text != "")
ObjectDataSource1.FilterExpression =
"convert(CreateDt,System.DateTime)>Convert('" +
Convert.ToDateTime(txtTransactionsFrom.Text) + "',System.DateTime)
and Convert(CreateDt,System.DateTime)<convert('"
+ Convert.ToDateTime(txtTransactionsTo.Text.ToString()) +
"',System.DateTime)";
else if (txtTransactionsFrom.Text != "")
ObjectDataSource1.FilterExpression =
"convert(CreateDt,System.DateTime)>convert('" +
Convert.ToDateTime(txtTransactionsFrom.Text) +
"',System.DateTime)";
else if (txtTransactionsTo.Text != "")
ObjectDataSource1.FilterExpression =
"convert(CreateDt,System.DateTime)
<convert('"
+ Convert.ToDateTime(txtTransactionsTo.Text.ToString()) +
"',System.DateTime)";
else
ObjectDataSource1.FilterExpression = " ";
grvBrokerage.DataSourceID = ObjectDataSource1.ID;
grvBrokerage.DataBind();
DateTime dtTransFrom = Convert.ToDateTime("1/1/1900");
DateTime dtTransTo = System.DateTime.Today;
//TransactionsTo Box is Empty
if ((txtTransactionsFrom.Text.Length > 2)
&& (txtTransactionsTo.Text.Length < 2))
{
dtTransFrom = Convert.ToDateTime(txtTransactionsFrom.Text);
dtTransTo = System.DateTime.Today;
}
//TransactionsFrom Box is Empty
if ((txtTransactionsFrom.Text.Length < 2)
&& (txtTransactionsTo.Text.Length > 2))
{
dtTransFrom = Convert.ToDateTime("1/1/1900");
dtTransTo = Convert.ToDateTime(txtTransactionsTo.Text);
}
//TransactionsFrom Box and TransactionsTo Box is Not Empty
if ((txtTransactionsFrom.Text.Length > 2)
&& (txtTransactionsTo.Text.Length > 2))
{
dtTransFrom = Convert.ToDateTime(txtTransactionsFrom.Text);
dtTransTo = Convert.ToDateTime(txtTransactionsTo.Text);
}
// Fails Here
grvBrokerage.DataSource =
BrokerageTransactions.GetAllWithDt(brokerageaccountdetails.BrokerageId,
dtTransFrom,
dtTransTo);
grvBrokerage.DataBind(); }
You got 2 options:
Do not use the ObjectDataSource at
all. You just use the DataSource
property and Set It grammatically
every time.
You use the DataSourceID property of the GridView and Add 2 plain asp:Parameters with default value set. On the ObjectDataSource_Selecting Event you set these parameters through e.InputParameters[]
Hope this helps.