On a grid with hyper link column, client event is not firing when clicking the hyper link. It is firing when you click any other column.
With Regards,
Babul
How to dyanamically add and delete rows to a RadGrid without causing a postback.
Grid contains text box to entry data.
With Regards,
Babul
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
| AddHandler rfeDocuments.ToolBar.ButtonClick, AddressOf toolBar_ButtonClick |
| Dim customButton As New RadToolBarButton() |
| customButton.CssClass = "test_button" |
| customButton.CommandName = "Rename" |
| customButton.Value = "TEST" |
| customButton.Text = "Rename" |
| rfeDocuments.ToolBar.Items.Add(customButton) |
| End Sub |
| Protected Sub toolBar_ButtonClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadToolBarEventArgs) |
| Label1.Text = e.Item.Value |
| End Sub |

| ///////////////////////// =========== OnBlur Events =========== ////////////////////////////////// |
| function QtyTxt_OnBlur() |
| { |
| var cntrlMtrxTable = $get('<%= tblMatrix.ClientID %>'); |
| if (cntrlMtrxTable) |
| { |
| CalculateMatrixTotals(cntrlMtrxTable); |
| } |
| } |
| /////////////////////////////////// UTILITIES //////////////////////////////////////// |
| ////////////////////////////////////////////////////////////////////////////////////// |
| /// Name: CalculateMatrixTotals() |
| /// Function Type: Event |
| /// Parameters: |
| ///////////////////////////////////////////////////////////////////////////////////// |
| function CalculateMatrixTotals(cntrlMtrxTable) |
| { |
| var cntrlTotalUsed = $get('<%= txtTotalUsed.ClientID %>'); |
| var cntrlTotalLeft = $get('<%= txtTotalLeft.ClientID %>'); |
| var cntrlCurrentLITotalQty = $get('<%= hdnCurrentLITotalQty.ClientID %>'); |
| var sumOfMatrixQty = 0; |
| var myInputArray = cntrlMtrxTable.getElementsByTagName("INPUT"); |
| for (var i = 0; i < myInputArray.length; i++) |
| { |
| var currInput = myInputArray[i]; |
| if (currInput.type == "text" && currInput.style.visibility != 'hidden' && currInput.id.indexOf('txtQty_') >= 0) |
| { |
| sumOfMatrixQty += currInput.value; |
| } |
| } |
| if (cntrlTotalUsed && cntrlTotalLeft && cntrlCurrentLITotalQty) |
| { |
| var LITotalQty = cntrlCurrentLITotalQty.value; |
| cntrlTotalUsed.value = sumOfMatrixQty; |
| cntrlTotalLeft.value = LITotalQty - sumOfMatrixQty; |
| alert('cntrlTotalUsed.value = ' + cntrlTotalUsed.value); |
| alert('cntrlTotalLeft.value = ' + cntrlTotalLeft.value) |
| alert('sumOfMatrixQty = ' + sumOfMatrixQty); |
| } |
| } |
| </script> |
| </telerik:RadScriptBlock> |
Hello ,
i am using a radRotator emedded in webpart the rotator works fine in asp web application , but when i use my web part the rotator didn't works fine . it didn't rotate to all item it just display the item no 2 then the rotator rotate to an empty item .and stop and nothing else occures ,
here is rotator
|
<% @ Control Language="C#" AutoEventWireup="true" Inherits="SACMSharePointWebPart.uc_FastTickerNews" %>
<% @ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI, Version=2009.1.402.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" %> <telerik:RadRotator ID="NewsRotator" RotatorType="AutomaticAdvance" ScrollDirection="Up" |
| SlideShowAnimation-Type="Fade" ScrollDuration="200" runat="server" Width="100%" |
| FrameDuration="6000" ItemHeight="30px" ItemWidth="100%" Height="30px" InitialItemIndex="0" |
| Skin="Vista"> |
| <ItemTemplate> |
| <table style="text-align: right;"> |
| <tr style="height: 30px;"> |
| <td> |
| <div style="width: 100%; filter: alpha(opacity=90); font-weight: bold; font-family: Tahoma; |
| background-color: #fff"> |
| <%# Eval("Location") %> |
| : </div> |
| </td> |
| <td style="padding-left: 10px"> |
| <div style="width: 100%; filter: alpha(opacity=90); font-family: Tahoma; |
| background-color: #fff"> |
| <telerik:RadTicker ID="RadTicker1" runat="server"> |
| <Items> |
| <telerik:RadTickerItem Text='<%# Eval("Title") %>' /> |
| </Items> |
| </telerik:RadTicker> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </ItemTemplate> |
| </telerik:RadRotator> |
| public class uc_FastTickerNews : UserControl |
| { |
| public RadRotator NewsRotator |
| { |
| get |
| { |
| return this.FindControl("NewsRotator") as RadRotator; |
| } |
| } |
| /// <summary> |
| /// Handles the Load event of the Page control. |
| /// </summary> |
| /// <param name="sender">The source of the event.</param> |
| /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| List<TickerNewsContainer> lst = new List<TickerNewsContainer>(); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "LOCATION 1" }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "LOCATION 2 " }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "3 LOCATION" }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "LOCATION4 " }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "5 LOCATION" }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "6 LOCATION" }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "LOCATION7 " }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "8 LOCATION" }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "9 LOCATION" }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "10 LOCATION" }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "LOCATION 11" }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "LOCATION 12 " }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "13 LOCATION" }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "LOCATION14 " }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "15 LOCATION" }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "16 LOCATION" }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "LOCATION17 " }); |
| lst.Add(new TickerNewsContainer { Title = "NEW NEWS", Location = "18 LOCATION" }); |
| this.NewsRotator.DataSource = lst; |
| this.NewsRotator.DataBind(); |
| } |
| } |
[ Guid("d879501c-6386-4646-bd57-cd012ca9f6e6")]
public class SACMFastTickerNews : System.Web.UI.WebControls.WebParts.WebPart
{
public uc_FastTickerNews FastTickerNews { get; set; }
{ } protected override void CreateChildControls() |
| { |
| base.CreateChildControls(); |
| this.FastTickerNews = (uc_FastTickerNews)Page.LoadControl("~/_controltemplates/uc_FastTickerNews.ascx"); |
| this.Controls.Add(this.FastTickerNews); |
| } |
| #region Events & Fixers |
| protected override void OnInit(EventArgs e) |
| { |
| base.OnInit(e); |
| ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page); |
| if (scriptManager == null) |
| { |
| scriptManager = new ScriptManager(); |
| if (this.Page.Form.FindControl("ScriptManager1") == null) |
| { |
| scriptManager.ID = "ScriptManager1"; |
| this.Page.Form.Controls.AddAt(0, scriptManager); |
| } |
| } |
| return scriptManager; |
| } |
| #endregion } |

I have columns with defined CssClass, like this one, for instance:
<telerik:GridBoundColumn HeaderStyle-CssClass='GridHeaderGreen ca' ItemStyle-CssClass='ca' HeaderText='Status' SortExpression='Wizard.AlertStatus.Name' DataField='Status.Name' />
In some cases I want to override the look of row cells for every column, i.e. i need to take ItemStyle.CssClass for the column and complement it with some additional class:
protected void rgAlertConfigView_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if ((e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) && e.Item.DataItem != null)
{
....
for (var i = 0; i < item.Cells.Count; i++)
{
item.Cells[i].CssClass = String.Format("{0} {1}", item.OwnerTableView.Columns[i].ItemStyle.CssClass, [some class depending on data in the row]);
}
}
rgView_ItemCreated(sender, e);
}
This stuff does not work, because there is some mess: item.Cells.Count = 12, item.OwnerTableView.Columns.Count = 10 (this is correct value) and there is no straight correspondence between Cell and Column and I cannot see how to establish it (?)
Every cell should be able to 'know' what is its column style.
p.s. Thanks to myself! At last I found solution:
for (var i = 0; i < item.OwnerTableView.Columns.Count; i++)
{
item[item.OwnerTableView.Columns[i]].CssClass = String.Format("{0} {1}{2}", item.OwnerTableView.Columns[i].ItemStyle.CssClass, item[item.OwnerTableView.Columns[i]].CssClass, dimmed);
}