Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
277 views
Hi,

I have a run-time generated RadWindow that has a variety of controls in it.  The RadWindow opens correctly when triggered, but when one of the buttons in the RadWindow is pressed, it causes postback, which wipes out the RadWindow.

How can I get client side Javascript to work without posting back to server?  

Below is the EditText sub that is called when a button is pressed that should open the RadWindow with the RadEditor in it.  When either the Save or Add button is pressed, the RadWindow disappears, and it doesn't look like it hits the Javascript functions.

Below that is the html for the page including some rudimentary javascript functions at the bottom I am trying to use to test this.

Thanks so much for looking at this!

aspx.vb
Private Sub EditText(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim buttonId As String
    Dim x As Integer
    Dim AN As Integer
 
    If C.UserSelectedAssessmentType = "CREATE" Then
        AN = C.UserSelectedAssessmentCount
    Else
        AN = C.UserSelectedAssessment
    End If
 
    buttonId = DirectCast(sender, RadButton).ID
    x = Mid(buttonId & "  ", 8, 2)
    EditingStatement = x
 
    w1.ContentContainer.Controls.Add(New LiteralControl("<div><table style=""width:725px""><tr><td>"))
 
    editL1.Text = "Use this editor"
    w1.ContentContainer.Controls.Add(editL1)
    w1.ContentContainer.Controls.Add(New LiteralControl("</td><td style=""text-align:right"">"))
 
    editSave.AutoPostBack = False
    editSave.CausesValidation = False
    editSave.OnClientClicked = "EditClickSave"
    editSave.ID = "editSave"
    editSave.Text = "Save"
    editSave.Width = 128
    w1.ContentContainer.Controls.Add(editSave)
    '  AddHandler editSave.Click, AddressOf Me.SaveEdit
    w1.ContentContainer.Controls.Add(New LiteralControl("</td></tr></table>"))
 
    popupEditor.ID = "Editor1"
    popupEditor.Width = 725
    popupEditor.Height = 350
    popupEditor.EditModes = EditModes.Design
    w1.ContentContainer.Controls.Add(popupEditor)
 
    editL2.Text = "Choose Item"
    w1.ContentContainer.Controls.Add(editL2)
    w1.ContentContainer.Controls.Add(New LiteralControl("<br />"))
 
    editCombo.ID = "editFindings"
    editCombo.Width = 410
    w1.ContentContainer.Controls.Add(editCombo)
 
    editAdd.AutoPostBack = False
    editAdd.CausesValidation = False
    editAdd.OnClientClicked = "EditClickAdd"
    editAdd.ID = "editAdd"
    editAdd.Text = "Add"
    editAdd.Width = 128
    w1.ContentContainer.Controls.Add(editAdd)
    '  AddHandler editAdd.Click, AddressOf Me.AddToEdit
    w1.ContentContainer.Controls.Add(New LiteralControl("<br /></div>"))
 
    w1.VisibleOnPageLoad = True
    w1.Modal = True
    w1.Height = 550
    w1.Width = 800
    '     w1.OnClientClose = "onClientClose"
 
    w1.Modal = True
 
    RadMultiPage1.PageViews(0).Controls.Add(w1)
 
    popupEditor.EnsureToolsFileLoaded()
 
 
End Sub

aspx
<%@ Page Title="" Language="VB" MasterPageFile="~/Master.master" AutoEventWireup="false" CodeFile="E14.aspx.vb" Inherits="Main" ValidateRequest="false" %>
<%@ MasterType VirtualPath="~/Master.master" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    <table id="footerTable">
        <tr>
            <td class="cl">   </td>
            <td style="text-align:center" class="cc">                              
                    <span class="style2">Edit Assessment</span> <br/>
                    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                    <br/>
                    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >
                        <AjaxSettings>                           
                            <telerik:AjaxSetting AjaxControlID="cReassessIn">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="Panel1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                            <telerik:AjaxSetting AjaxControlID="Timer1">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="lRefresh" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                        </AjaxSettings>
                    </telerik:RadAjaxManager>
                    <asp:Label ID="TopHeader" runat="server" Font-Italic="True" Width="100%"></asp:Label>
                    <br/>
                    <asp:Panel ID="Panel1" runat="server" BorderStyle="Ridge" BorderWidth="3px" Width="95%" HorizontalAlign="Left" DefaultButton="bStore">
 
                        <telerik:radtabstrip id="RadTabStrip1" runat="server" width="100%" Skin="Outlook" AutoPostBack="True">
                            <Tabs>
                                <telerik:RadTab ID="Tab1" runat="server" Text="1" Visible="False"></telerik:RadTab>
                                <telerik:RadTab ID="Tab2" runat="server" Text="2" Visible="False"></telerik:RadTab>
                            </Tabs>
                        </telerik:radtabstrip>
                        <hr/>
                        <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Width="100%" SelectedIndex="0">
                            <telerik:RadPageView ID="PageView1" runat="server">
                            </telerik:RadPageView>
                            <telerik:RadPageView ID="PageView2" runat="server" Width="100%">
                            </telerik:RadPageView>  
                        </telerik:RadMultiPage>
                        <br/>
                        <hr/>
                        <table style="width:100%">
                            <tr>
                                <td style="vertical-align:top">                                      
                                    <telerik:RadComboBox  ID="cAssessmentFinal" runat="server" Width="410px">
                                            <Items>
                                                <telerik:RadComboBoxItem runat="server" Text="Exceeds" Value="0" />
                                                <telerik:RadComboBoxItem runat="server" Text="Meets" Value="1" />
 
                                        </Items>                                       
                                    </telerik:RadComboBox>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <asp:Label ID="lRefresh" runat="server" Font-Bold="True"></asp:Label>
                      
                      
                    <asp:Label ID="lTO" runat="server" Width="140px"></asp:Label
                      
                      
                              
                      
                    <asp:Panel ID="Panel2" runat="server">
                        <asp:Timer ID="Timer1" runat="server" Interval="120000" OnTick="Timer1_Tick"/>
                        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" OnClientClose = "CommentsListPopUpRadWindow_OnClose">
                        </telerik:RadWindowManager>
                    </asp:Panel>               
            </td>
            <td class="cr">   </td>
        </tr>
    </table>
 
    <asp:PlaceHolder runat="server">
      <script type="text/javascript">
          function EditClickAdd() {
              var editor = $find("<%=popupEditor.ClientID%>");
              editor.pasteHtml("This is a test");         
          }
          function EditClickSave() {
              var editor = $find("<%=popupEditor.ClientID%>");
              editor.pasteHtml("This is a test");
              document.getElementById("Label1").value = editor.getselectionhtml + "asdf";
                         
          }
      </script>
        </asp:PlaceHolder>
</asp:Content>
Princy
Top achievements
Rank 2
 answered on 20 Dec 2013
7 answers
1.1K+ views
Hi,
I am trying to Expand/Collapse group in radgrid from client side by finding the Grouping panel and comparing the text of it.
I am finding the Grouping Panel image and trying to trigger click functionality as mentioned in the example provided by telerik.But it is not working.The code is as below.
var gridload = <%=RadGrid1.ClientID %>;
for(var index = 0; index < gridload.Iw.MasterTableView.Controls[0].Rows.length; index++)
{
if(gridload.Iw.MasterTableView.Controls[0].Rows[index].ItemType == "GroupHeader")

{

for

(var i = 0; i < gridload.Iw.GroupPanel.GroupPanelItems.length; i++)

{

if

(gridload.Iw.MasterTableView.Controls[0].Rows[index].Control.cells[i])

{

if

(gridload.Iw.MasterTableView.Controls[0].Rows[index].Control.cells[1].innerText == "Venture Capital")

{

groupColumnImage = gridload.Iw.MasterTableView.Controls[0].Rows[index].Control.cells[i].firstChild;

groupColumnImage.src= originalAttribute="src" originalPath=""

"http://localhost:2541/WebSitetest/RadControls/Grid/Skins/Default/SingleMinus.gif";

gridload.Iw.MasterTableView.Controls[0].Rows[index].Expanded =

true;
groupColumnImage.click();

}

}

}

}

}
Can anyone let me know the fix for the above issue.

Thanks,
Avik.

Eyup
Telerik team
 answered on 20 Dec 2013
2 answers
366 views
Hi,

I'm using telerik report 2011 in my page. I want to download pdf directly without loading the report viewer on button click event.



Thanks,
Prasanna
Prasanna
Top achievements
Rank 1
 answered on 20 Dec 2013
1 answer
283 views

I have a web page that primarily contains a telerik radgrid. There are 30 grid bound columns in it. So we are displaying a horizontal scroll bar, by setting Scrolling-AllowScroll ="true"Scrolling-UseStaticHeaders="true"

when we browe the page, everything is wroking fine. Horizontal scroll is moving the column headers along with data and vertical scroll is keeping the column headers static.

In CRM we added a subarea and loading the page. In CRM, the column headers are static for horizontal scroll, which is not correct. Also, it is noticed that after a postback or refresh happens, it starts working fine. We tried to explicity invoke postback and refresh but in vain.

Please help me fix the issue.

Venelin
Telerik team
 answered on 20 Dec 2013
1 answer
169 views
I'm using Version: 2012.1.215.35 and I'm trying to create a grid that has multi-column headers that span 2 columns. I want to be able to export this grid to CSV and I'm running into problems. 
  • The column names are missing
  • The values are all together without being separated by commas.  (e.g.  "25 25%")

Here is my front end code:

<telerik:GridTemplateColumn ItemStyle-CssClass="rollupItem" HeaderStyle-CssClass="rgHeader rollupHeader" UniqueName="TemplateColumn">
    <HeaderTemplate>
        <table id="ContactTableHeader" cellspacing="0" cellpadding="0" width="100%" border="0">
            <tr class="rollupTopHeader">
                <td colspan="2" align="center">
                    <asp:Label ID="hasReceived" runat="server" Text='Has Received Prior'></asp:Label>                                                       
                </td>                                                   
            </tr>
            <tr class="rollupBottomHeader">
                <td width="16%" align="center">
                    <asp:Label ID="hasReceivedTreatmentCountLabel" runat="server" Text='Count'></asp:Label>
                </td>
                <td width="16%" align="center">
                    <asp:Label ID="hasReceivedTreatmentPercentLabel" runat="server" Text='Percent'></asp:Label>
                </td>                                                                                                                                                         
            </tr>
        </table>   
    </HeaderTemplate>
    <ItemTemplate>
        <table id="ContactRelationshipTable" cellspacing="0" cellpadding="0" width="100%" border="0">
            <tr class="rollupData">
                <td width="16%">
                    <asp:Label ID="hasReceivedTreatmentCount" runat="server" Text='<%# Eval("HasReceivedTreatmentCount") %>'></asp:Label>                                                       
                </td>
                <td width="16%">
                    <asp:Label ID="hasReceivedTreatmentPercent" runat="server" Text='<%# Eval("HasReceivedTreatmentPercent") %>'></asp:Label>                                                                                                               
                </td>                                                                                                   
            </tr>
        </table>       
    </ItemTemplate>                                  
</telerik:GridTemplateColumn>

Back end code:
protected void ExportToCSVButton_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
    try
    {
        RollupReportRadGrid.ExportSettings.ExportOnlyData = false;
        RollupReportRadGrid.MasterTableView.ExportToCSV();
    }
    catch (Exception ex)
    {
        GenericException.HandleException(ex);
        Response.Redirect("~/GenericError.aspx");
    }
}

Can someone help with this problem? 

Thanks,
Katy Maffei

Princy
Top achievements
Rank 2
 answered on 20 Dec 2013
5 answers
171 views

Hi,

I'm using Masked textbox multiline mode. 

and prapare the mask like,
protected void Page_Load(object sender, EventArgs e)
{
    string mask = string.Format("xxxx: L## xx: #######{0}", Environment.NewLine);
 
    StringBuilder maskBuilder = new StringBuilder();
    for (int i = 0; i < 5; i++)
    {
        maskBuilder.AppendFormat("{0}", mask);
    }
    RadMaskedTextBox1.Mask = maskBuilder.ToString();
}

this mask displaying correctly firefox and chrome but IE not displaying correctly. 

I,m faced with this situation after updating version

new version:  2013.3.1114.40
previous version : 2012_3_1205
Shinu
Top achievements
Rank 2
 answered on 20 Dec 2013
1 answer
242 views
Hi All,

I have a GridBoundColumn with numbers in it.  Is it at all possible to center the numbers in the column, but right align them, so that the are all lined up, down the column?  For example the decimal place of each number is in the same spot regardless of the overall length of the number.

Thanks,
Mark
Shinu
Top achievements
Rank 2
 answered on 20 Dec 2013
1 answer
304 views
I am trying to use EditItemTemplate in RadGrid but I am unable to do it as the page comes back with just the 'RadTextBox' instead of full grid. Attached is the image of the result I get while using EditItemTemplate. If I remove <EditItemTemplate> bit everything works fine. I just want to use my own custom controls in RadGrid while editing / inserting items. Following is the code I am using. Please help me with this issue. Can't work out this issue as this should be simple enough.

<telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" AllowAutomaticDeletes="True"

AllowAutomaticInserts="True" PageSize="10" Skin="Default" AllowAutomaticUpdates="True" AllowPaging="True"

AutoGenerateColumns="False" Width="750px" DataSourceID="SqlDataSource_nonCot">

<MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="ItemID"

DataSourceID="SqlDataSource_nonCot" HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">

<BatchEditingSettings EditType="Cell" />

<SortExpressions>

<telerik:GridSortExpression FieldName="ItemID" SortOrder="Descending" />

</SortExpressions>

<Columns>

<telerik:GridBoundColumn DataField="ItemID" HeaderStyle-Width="210px" HeaderText="ItemID" SortExpression="ItemID"

UniqueName="ItemID">

</telerik:GridBoundColumn>

<telerik:GridTemplateColumn HeaderText="ItemTypeID" HeaderStyle-Width="180px" UniqueName="ItemTypeID" DataField="ItemTypeID">

<ItemTemplate>

<%# Eval("ItemTypeID") %>

</ItemTemplate>

<EditItemTemplate>

<telerik:RadTextBox ID="txt_itemID" runat="server" />

</EditItemTemplate>

</telerik:GridTemplateColumn>

</Columns>

</MasterTableView>

</telerik:RadGrid>




Princy
Top achievements
Rank 2
 answered on 20 Dec 2013
3 answers
273 views
Hi All,

Can anyone please tell me how to auto-size the drop-down of a combobox in code-behind?  I have found the following link:
http://www.telerik.com/help/aspnet-ajax/combobox-auto-width.html

Ideally, both height and width would auto-adjust with the height maxing out at the bottom of the screen.  Is this at all possible?

Thanks,
Mark
Shinu
Top achievements
Rank 2
 answered on 20 Dec 2013
2 answers
134 views
I think I'm being stupid on this one but I need to ask.

I have a UserControl with a RadDateTimePicker and the SelectedDateChanged event set to get handled in server codebehind. When the date or time are changed by the user, the event is fired, but neither the 'sender' nor the arguments object have all of the data.

The sender is the control but the SelectedDate on the sender is null. Sometimes the sender FocusedDate has the new value. In the SelectedDateChangedEventArgs value, the OldDate and NewDate are null.

The events being fired are in this order on PostBack:
Page_Load in the parent container, where I invoke setup methods in all user controls to set their initial values.
Page_Load for all user controls.
SelectedDateChanged
Page_LoadComplete for parent
Page_LoadComplete for each UC.
Then in Page_PreRender I get the control data and save it to SessionState so that I can refresh it the next time in.

I felt a need to go through that because controls initially weren't refreshing after postback.

I'm wondering if the sender or arguments are getting trashed prior to the SelectedDateChanged event because I load from state before that event fires. But that doesn't make sense to me.

Any ideas?
Thank you VERY much.
TonyG
Top achievements
Rank 1
 answered on 19 Dec 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?