What i need to happen is that after a user logs in and the page goes to Home.aspx, I need the Home RadMenuItem to be selected on page load. When they click About it will go to About.aspx page and select the About RadMenuItem on page load. Please advice
MasterPage.master: <telerik:RadMenu runat="server" ID="mnuTopBar" EnableEmbeddedSkins="false" Width="800px"></telerik:RadMenu>
On Home.aspx:
Private Sub SelectMenu()
Dim menu As New RadMenu
Dim currItem As New RadMenuItem
menu = DirectCast(Me.Page.Master.FindControl("mnuTopBar"), RadMenu)
End Sub
Above is all i have so far. I have tried currItem = menu.FindItemByText("Home") but getting nothing on currItem. Please advice...
How can I go about formatting a column when AutoGenerateColumns="true"?
I have a recordset returned from the database and I needed to transpose the data which I have done successfully. Now I would need to format that rows data to either currency or percentage. The number of columns will be dynamic but the number of rows will be static.
Attached is an image of what my data looks like I need formatted.
<
telerik:RadGrid
ID
=
"grdResults"
runat
=
"server"
>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"True"
SaveScrollPosition
=
"true"
></
Scrolling
>
<
Selecting
AllowRowSelect
=
"true"
/>
<
Resizing
AllowColumnResize
=
"true"
/>
</
ClientSettings
>
<
MasterTableView
AutoGenerateColumns
=
"true"
HeaderStyle-Width
=
"100px"
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"RowNumber"
Visible
=
"false"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblRowNumber"
runat
=
"server"
/>
</
ItemTemplate
>
<
ItemStyle
Font-Bold
=
"true"
Width
=
"20px"
/>
<
HeaderStyle
Width
=
"50px"
/>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"RowText"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblRowText"
runat
=
"server"
/>
</
ItemTemplate
>
<
ItemStyle
Font-Bold
=
"true"
Width
=
"20px"
/>
<
HeaderStyle
Width
=
"300px"
/>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
oConn.Open()
Dim
ocmd
As
New
SqlCommand(
"myStoredProc"
, oConn)
ocmd.CommandType = CommandType.StoredProcedure
With
ocmd.Parameters
.Add(
New
SqlParameter(
"@my_num"
, 95778))
End
With
reader = ocmd.ExecuteReader
If
reader.HasRows
Then
Dim
dt
As
DataTable =
New
DataTable()
dt.Load(reader)
'GetTransposedTable(dt)
grdResults.DataSource = GetTransposedTable(dt)
grdResults.DataBind()
End
If
End
Sub
Function
GetTransposedTable(
ByVal
dtOriginal
As
DataTable)
As
DataTable
Dim
dtReflection
As
New
DataTable(
"Reflection"
)
For
i
As
Integer
= 0
To
dtOriginal.Rows.Count - 1
dtReflection.Columns.Add(dtOriginal.Rows(i)(0))
Next
Dim
row
As
DataRow
For
j
As
Integer
= 1
To
dtOriginal.Columns.Count - 1
row = dtReflection.NewRow
For
k
As
Integer
= 0
To
dtOriginal.Rows.Count - 1
row(k) = dtOriginal.Rows(k)(j)
Next
dtReflection.Rows.Add(row)
Next
Return
dtReflection
End
Function
Private
Sub
grdResults_ItemDataBound(sender
As
Object
, e
As
GridItemEventArgs)
Handles
grdResults.ItemDataBound
'Set Row Count
If
TypeOf
e.Item
Is
Telerik.Web.UI.GridDataItem
Then
Dim
rowCounter
As
Integer
= 0
Dim
lblRowNumber
As
Label = TryCast(e.Item.FindControl(
"lblRowNumber"
), Label)
Dim
lblRowText
As
Label = TryCast(e.Item.FindControl(
"lblRowText"
), Label)
rowCounter = grdResults.MasterTableView.PageSize * grdResults.MasterTableView.CurrentPageIndex
lblRowNumber.Text = (e.Item.ItemIndex + 1 + rowCounter).ToString()
If
lblRowNumber.Text = 1
Then
lblRowText.Text =
"Total Assets"
ElseIf
lblRowNumber.Text = 2
Then
lblRowText.Text =
"Total Shares"
ElseIf
lblRowNumber.Text = 3
Then
lblRowText.Text =
"Net Capital"
ElseIf
lblRowNumber.Text = 4
Then
lblRowText.Text =
"Total Loans"
ElseIf
lblRowNumber.Text = 5
Then
lblRowText.Text =
"Allowance for Loan Losses"
ElseIf
lblRowNumber.Text = 6
Then
lblRowText.Text =
"Total Delinquency - Delinquent Loans (>2 mo)"
ElseIf
lblRowNumber.Text = 7
Then
lblRowText.Text =
"Net Capital Ratio"
ElseIf
lblRowNumber.Text = 8
Then
lblRowText.Text =
"Delinquency Ratio"
ElseIf
lblRowNumber.Text = 9
Then
lblRowText.Text =
"Operating Expenses - Annualized Operating Exp Ratio"
ElseIf
lblRowNumber.Text = 10
Then
lblRowText.Text =
"Net Income/(Loss) - Annualized ROA"
ElseIf
lblRowNumber.Text = 11
Then
lblRowText.Text =
"Net Charge-Offs/Avg. Loans - Annualized Net C/O"
ElseIf
lblRowNumber.Text = 12
Then
lblRowText.Text =
"Coverage Ratio (ALL-to-Delq)"
ElseIf
lblRowNumber.Text = 13
Then
lblRowText.Text =
"Interest Margin"
ElseIf
lblRowNumber.Text = 14
Then
lblRowText.Text =
"Other Income"
ElseIf
lblRowNumber.Text = 15
Then
lblRowText.Text =
"Provision for Loan Losses"
End
If
End
If
End
Sub
What I need to do is set a ​GroupHeaderTemplate link to 1 of 2 URL's based upon the value of a ​GridBoundColumn.
If Section="Marketing" then display 1st URL
else
display 2nd URL
How would I go about doing this?
<
GroupHeaderTemplate
>
<
a
href='/CUTracking/Notes/Default.aspx?
Section
=
FMS
&SearchCharterNum=<%# Eval("Charter_Num") %>' title="View <%# Eval("CUName")%> notes section"><%# Eval("CUName")%></
a
>
</
GroupHeaderTemplate
>
<
telerik:GridBoundColumn
HeaderText
=
"SECTION"
UniqueName
=
"Section"
FilterControlAltText
=
"Filter column column"
DataField
=
"Section"
>
<
ColumnValidationSettings
>
<
ModelErrorMessage
Text
=
""
></
ModelErrorMessage
>
</
ColumnValidationSettings
>
<
ItemStyle
HorizontalAlign
=
"Center"
/>
<
HeaderStyle
HorizontalAlign
=
"Center"
Width
=
"100px"
/>
</
telerik:GridBoundColumn
>
I attempted doing it on RadGrid.ItemDataBound but received an error because it didn't have a dataitem called "Section".
If DataBinder.Eval(e.Item.DataItem, "Section") = "Marketing" Then
After installing the new version Q2 2015 I have some problems launching the procedure converted to Visual Studio 2013.
Using IIS Express using some controls like grid are several errors in JavaScript regarding Telerik.Web.UI.WebResource.axd.
Launching the application with IIS these problems disappear (fortunately).
The message that comes out is always the same: "Cannot use a leading .. to exit above the top directory."
It 'a very serious problem that prevents it from working correctly with Visual Studio 2013.
Thanks in advance.
Good morning Community,
I'm having an issue under Chrome browser that is not allowing me to set the page index and a selected item. The scenario is that I have a main page showing a list of items. I use RadWindow as popup to add & edit actions. At code behind I use try and catch. If no exception is catched I call a javascript function to close RadWindow and pass "ok" as parameter, in case of an exception inside catch I call the same function but with "error" as parameter.
This function looks as follow, depending the parameter I am calling two different javascript functions from parent page:
function CloseWindow(refreshParent) {
GetRadWindow().close();
if (refresh​Parent == "yes") {
CallFunctionOnParentPage("RefreshSuccess");
}
else {
CallFunctionOnParentPage("RefreshError");
}
}​
These functions from parent are used to refresh grids and show message of success or error at the top of the page. A postback is executed, I set the EVENTTARGET (1st value) and EVENTARGUMENT (2nd value):
function RefreshSuccess() {
__doPostBack("<%= uppMain.ClientID %>", "ok");
}
function RefreshError() {
__doPostBack("<%= uppMain.ClientID %>", "error");
}
So, when the postback is executed on parent's Page_Load method (at code behind) I'm checking the value of target & argument and then I can set the color of the message (blue if success, salmon when error)
string eventTarget = Request.Params.Get("__EVENTTARGET");
switch (eventTarget)
{
case "MainCPH_uppMain":
string resultMessage = Request.Params.Get("__EVENTARGUMENT");
if (resultMessage == "ok")
{
lblMessage.Attributes.Add("style", "display:block");
lblMessage.BackColor = System.Drawing.Color.LightSkyBlue;
lblMessage.Text = "The information has been successfully saved.";
}
else
{
lblMessage.Attributes.Add("style", "display:block");
lblMessage.BackColor = System.Drawing.Color.Salmon;
lblMessage.Text = "A problem has ocurred when saving the information.";​
}
}
When adding a new item to the grid (alphabetic order), I require to make the new element appear as selected, including if necessary a change of page. For this, when the save was successful I'm searching for the newest item's ID, page by page and set its selected property to true:
NOTE: I am using multi-tier structure, so I have a Model layer where I have a definition of the model Item, I use a list of those models as datasource of the grid and that is why I cast the items to that model.
int i = 0;
for(i=0; i < gridItems.PageCount; i++)
{
gridItems.CurrentPageIndex = i;
gridItems.MasterTableView.Rebind();
foreach (GridDataItem item in gridItems.Items)
{
Model.​Item ​myItem= (Model.​Item)item.DataItem;
if (​myItem.CompanyID == ​newestID)
{
item.Selected = true;
break; // break, once it is found there is no need to keep searching
}
}
}
And well, here is the issue, everything is working just fine under Firefox and Internet Explorer, but for some reason is not working under chrome, the page of the grid is not changing and the new item does not appear as selected. So, the .CurrentPageIndex and the .Selected seems not to be working. Any ideas?
I tried to simplify my example, the real page is using different tabs (that's why I need the EVENTTARGET, as sometimes I only need to refresh one tab but in some cases I need to refresh multiple tabs). The page is also calling different RadWindows. That is why I would like to keep the solution of the issue at the same level that I have the logic, at Page_Load method under Parent's codebehind.
Thanks in advance, any hint will be highly appreciated. Let me know if more details are required.
Regards,
Oscar
I have a RadScheduler instance on a DNN UserControl. The back end of the control feeds data called Alerts into the scheduler. Most alerts are intended to be recurring, usually once a week or semi-weekly, etc.
<
div
class
=
"My_Container"
>
<
div
class
=
"My_Calendar"
>
<
telerik:RadScheduler
ID
=
"alertRadScheduler"
runat
=
"server"
OnAppointmentDataBound
=
"RadScheduler1_AppointmentDataBound"
Skin
=
"Metro"
Height
=
"450"
OverflowBehavior
=
"Auto"
AllowInsert
=
"False"
AllowEdit
=
"False"
SelectedView
=
"MonthView"
ShowFooter
=
"false"
EnableRecurrenceSupport
=
"True"
DayStartTime
=
"08:00:00"
DayEndTime
=
"21:00:00"
FirstDayOfWeek
=
"Sunday"
LastDayOfWeek
=
"Saturday"
OnClientFormCreated
=
"schedulerIsCompleted"
EnableDescriptionField
=
"true"
AppointmentStyleMode
=
"Simple"
EnableCustomAttributeEditing
=
"True"
CustomAttributeNames
=
"IsComplete, CompletedRecurrences2"
OnClientAppointmentClick
=
"OnClientAppointmentClick"
OnClientAppointmentInserting
=
"OnClientAppointmentInserting"
>
<
Localization
AdvancedEditAppointment
=
"Edit Alert"
AdvancedNewAppointment
=
"New Alert"
/>
<
AppointmentTemplate
>
<
div
class
=
"My_CalendarAlert"
>
<
a
ng-click
=
"(<%# Eval("
Id").ToString().Split('_')[0] %>)"
data-recid="<%# Eval("Id").ToString().Split('_').Length > 1 ? Eval("Id").ToString().Split('_')[1] : "" %>">
<
span
class
=
"ball"
></
span
><%# Eval("Subject") %>
</
a
>
</
div
>
</
AppointmentTemplate
>
<
InlineInsertTemplate
>
</
InlineInsertTemplate
>
</
telerik:RadScheduler
>
</
div
>
</
div
>
As you can see in the block, I have default Monthly view and how we do add/edit options etc. The end result of how the Alert (Appointment) looks on the calendar days themselves is a red or green square followed by the name (cut off if the name is too long to fit in the box). You click the Alert to open a custom editor. The choice between Red and Green square is based on a 'Completed Reccurences' list for the user which says that for a given Alert, recurrence indexes X,Y,Z are Completed if they are present in that Completed list. Completed are Green, the rest are Red.
Now all of this has been working to set up recurrences by generating the rules, etc. and we just now figured out that the Recurrence Indexes are based on the Monthly View that you are currently looking at. We were expecting that if something started on X date and recurred weekly, then 2 months later the indexes should be somewhere like 8-12, but they are not.
For instance, we have a recurrence set to start on Friday, July 3rd on a weekly basis. It shows up every Friday like intended. The user has 'completed' the Recurrences that are on the 3rd, 10th, 17th and 24th of July (these are in green), but not the 31st (this one is in red). That is all working as expected.
https://i.gyazo.com/224f03a5e3fa90ed5e39e46506d66659.png
However, we jump to the next month, August. No recurrences have been completed for this month (since that is in the future​) and here is what we see:
https://i.gyazo.com/94a6136e9c79bfe006f9a5a084543eba.png
The indexes, starting from July 31st (the fifth instance) are reset to start from ​0. Since I have 'Completes' recorded for "",0,1,2 it's marking those as complete in the UI. However since these are instances that should be starting with "3" on the 31st, I should be seeing 3,4,5,6,7 in the month of August.
If this were related to what Month it was, where in the index was reset at the beginning of the month and the 7th of August (the first Friday to contain the Alert), I could handle that by adding the Month to my database and call it part of the unique id. But with it based on whatever view the user is looking at I can't reliably do that.
What can I do to fix this? I need permanent indexing based on when the recurrence rule actually started, not based on the view the user is looking at on the page.