Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
272 views

Hi,
I am trying to callback with image button inside radgrid <detailtables>. Server side code is executed but the control is not returned to javascript function that is receiving the results.
Can you help me?!

protected void Page_Load(object sender, EventArgs e)
        {      
               ClientScriptManager cm = Page.ClientScript;
                cbReference = cm.GetCallbackEventReference(this, "arg",
                    "ReceiveServerData", "", "errorData", false);
                String callbackScript = "function CallServer(arg, context) {" +
                    cbReference + "; WebForm_InitCallback(); }";
                cm.RegisterClientScriptBlock(this.GetType(),
                    "CallServer", callbackScript, true);
 
        }
public void RaiseCallbackEvent(String eventArgument)
        {
            //fetch some data
        }
   public string GetCallbackResult()
        {
            return strJSON;
        }

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" EnableAJAX="False"
    HorizontalAlign="NotSet" LoadingPanelID="RadAjaxLoadingPanel1">
 
    <telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" GridLines="None" AllowAutomaticDeletes="True"
        AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowFilteringByColumn="True"
        AllowPaging="True" DataSourceID="SqlDataSource1" ShowGroupPanel="True" AllowSorting="True"
        Skin="Office2010Blue" Height="100%" Width="100%" GroupLoadMode="Server" OnItemInserted="RadGrid1_ItemInserted"
        OnInsertCommand="RadGrid1_InsertCommand"
        OnItemCommand="RadGrid1_ItemCommand" onitemdatabound="RadGrid1_ItemDataBound">
...
 <DetailTables>
                <telerik:GridTableView Name="Detail" DataKeyNames="ExamID" AllowSorting="false" DataSourceID="SqlDataSource2"
                    Width="100%" PageSize="10" ShowHeader="False" RetrieveAllDataFields="false" runat="server"
                    CommandItemDisplay="Top" EditMode="EditForms" NoDetailRecordsText="No records to display."
                    AutoGenerateColumns="false" AllowAutomaticUpdates="true" AllowAutomaticDeletes="false"
                    AllowAutomaticInserts="false" CommandItemSettings-AddNewRecordText="New exam">
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="CertificationID" MasterKeyField="CertificationID" />
                    </ParentTableRelation>
                    <AlternatingItemStyle />
                    <NoRecordsTemplate>
                        <asp:Label runat="server" Text="No records."></asp:Label>
                    </NoRecordsTemplate>
                    <EditFormSettings ColumnNumber="1" CaptionDataField="Exam" InsertCaption="New exam"
                        CaptionFormatString="Edit properties of exam {0}">
                        <FormTableItemStyle Width="100%" Height="29px" />
                        <FormTableStyle GridLines="None" CellPadding="2" CellSpacing="0" />
                        <FormStyle Width="100%" BackColor="#eef2ea" />
                        <EditColumn ButtonType="ImageButton" CancelText="Cancel" UpdateText="Update" InsertText="Add" />
                    </EditFormSettings>
                    <CommandItemSettings AddNewRecordText="New exam"
                        ExportToPdfText="Export to PDF" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridEditCommandColumn ButtonType="LinkButton" ItemStyle-Width="50px"
                            UniqueName="EditCommandColumn">
                            <ItemStyle Width="50px" />
                        </telerik:GridEditCommandColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete"
                            Text="Delete2" UniqueName="DeleteColumn">
                        </telerik:GridButtonColumn>
                        <telerik:GridTemplateColumn></telerik:GridTemplateColumn>
                        <%--<telerik:GridBoundColumn DataField="CertificationID" FilterControlAltText="Filter exam number column"
                            HeaderText="Certification ID" UniqueName="CertificationID" ReadOnly="true" />
                        <telerik:GridBoundColumn DataField="ExamID" FilterControlAltText="Filter exam number column"
                            HeaderText="Exam ID" UniqueName="ExamID" ReadOnly="true">
                        </telerik:GridBoundColumn>--%>
                        <telerik:GridBoundColumn DataField="Exam" DataType="System.String"
                            FilterControlAltText="Filter exam number column" HeaderText="Exam number"
                            UniqueName="Exam">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Name"
                            FilterControlAltText="Filter Name column" HeaderText="Exam name"
                            UniqueName="Name">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn UniqueName="ArrowColumn">
                            <ItemTemplate>
                            dsds
                                <asp:ImageButton BorderStyle="Solid" ID="ImageButton1" AlternateText="Delete4" runat="server" CommandName="Delete4"
                                ImageUrl="~/_layouts/Images/Delete.GIF" OnClientClick="ConfirmDelete;" />
                            </ItemTemplate>
                            <HeaderStyle Width="30px" />
                        </telerik:GridTemplateColumn>
                         <telerik:GridTemplateColumn UniqueName="ArrowColumn2">
                            <ItemTemplate>
                                <input type="button" id="buttondel" value="Callback" runat="server" onclick="CallServer(1,1);" />
                            </ItemTemplate>
                            <HeaderStyle Width="30px" />
                        </telerik:GridTemplateColumn>                       
                    </Columns>                  
                </telerik:GridTableView>
            </DetailTables>
function ReceiveServerData(arg, context) {
        var c = eval(arg);
        for (var i in c) {
            $("#ResultsTable2 tr:last").after("<tr><td>" + c[i][0] + " - " + c[i][1] + "</td><td>");
        }        
    }


Solved:

Problem was in String callbackScript = "function CallServer(arg, context) {" +
cbReference + "; WebForm_InitCallback(); }";

called after cbreference and not clearing

__theFormPostData and __theFormPostCollection viewstate variables.


Solution that worked for me:
ClientScriptManager cm = Page.ClientScript;
            cbReference = cm.GetCallbackEventReference(this, "arg",
                "ReceiveServerData", "", "errorData", false);
            String callbackScript = "function CallServer(arg, context) { __theFormPostData = ''; __theFormPostCollection = new Array(); WebForm_InitCallback();" +
                cbReference + "; }";
Vasil
Telerik team
 answered on 28 Sep 2011
1 answer
106 views
Hi Tlerik,

I'm using radchart of line type in my application.
I'm adding serieses to the cart from code behind.
I'm adding 4 series based on the user selction like if user select 1 then I add 1 series, if he select 2 then I add second like that.
But In legend its showiing the all serieses name by default.
But I want to show only whatever series I added to the chart.
If I add 2 serieces I need to show only those 2 serieses names in legend...like that.
How can I do that , please help me.
Missing User
 answered on 28 Sep 2011
1 answer
151 views
hello,
i'm creating a few radcombobox inside the radpanelbar. i already make connection to database for 1st combobox. how can i do the other connection to other combobox?

this is the 1st combobox for user
<td>

 <telerik:RadComboBox ID="RadComboBox1" AllowCustomText="true" runat="server" Width="289px"

 Height="200px" DataSourceID="SqlDataSource1" DataTextField="UserName"

 EmptyMessage="Search for people...">

 </telerik:RadComboBox>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:FingertipsConnectionString %>"

SelectCommand="SELECT [UserName] FROM [AuditTrail] Order By UserName"></asp:SqlDataSource>

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

<AjaxSettings>

<telerik:AjaxSetting AjaxControlID="RadComboBox2">

<UpdatedControls>

<telerik:AjaxUpdatedControl ControlID="RadComboBox1" />

 </UpdatedControls>

 </telerik:AjaxSetting>

 </AjaxSettings>

 </telerik:RadAjaxManager>
</td> </tr>

 

 

this is the 2nd combobox for database. this combobox i want to connect to database to get the content from column "database"
<td>

<asp:Label runat="server" ID="databaseLabel" AssociatedControlID="RadComboBox3">Database:</asp:Label>

 </td>

<td>

<telerik:RadComboBox ID="RadComboBox3" AllowCustomText="true" runat="server" Width="289px"

 Height="200px" DataSourceID="SqlDataSource2"

 EmptyMessage="Search for database...">

 </telerik:RadComboBox>

  <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:FingertipsConnectionString %>"

 SelectCommand="SELECT [Database] FROM [AuditTrail]"></asp:SqlDataSource>

 </td>


Shinu
Top achievements
Rank 2
 answered on 28 Sep 2011
5 answers
112 views
We subscribe to a service that allow us to drag and drop controls just such as buttons, text box, radio buttons, drop down list etc. onto a form without programming. I like to create an application that will allow our users to create their own forms without doing a single line of coding. Will Telerik controls allow us to do that?
Sebastian
Telerik team
 answered on 28 Sep 2011
6 answers
228 views
I have a RadEditor control instead a RadPane/RadTabStrip.  I set it to use the RibbonBar to render the menu.  At initial page load all of this is hidden; it's made visible later with Ajax and the RadAjaxManager.  The editor has a fixed height and 100% width.  The pane has 100% width.

If the tab in which the editor is shown is not the active tab when the Ajax call updates the screen, the ribbonbar doesn't seem to render right.  It'll look like my screenshot in attachment snag-0002 or snag-0004 or snag-0005.  It will render properly if the editor is in the visible tab when the screen is updated.

It does this in the latest versions of Chrome and Firefox and Telerik 2011.2.712 and .NET 4.0.

I know it's a common problem to have complex controls like this render improperly when they are first loaded while hidden.  Any ideas how to fix it in this case?  I know I could switch back to the traditional toolbar to fix this but I'd hate to do that...

(I did try setting the RadPage and RadEditor to fixed widths but it didn't fix the problem)

Nikolay Tsenkov
Telerik team
 answered on 28 Sep 2011
9 answers
202 views
Im trying to upgrade the web project and getting object ref not found errors..

Also its trying to create virt directories when I load the vs2008 project..

Will there be a VS2010 version soon  ?

Iana Tsolova
Telerik team
 answered on 28 Sep 2011
3 answers
82 views
Hi there,

I have a RadGrid with a MasterTableView and an inner GridTableView, as in master-detail samples. I want to enable sorting just on inner TableView.

When I click some column, an error shows up telling a field from detail object wasn't found on master object.

How can I address this?

TIA.

Rubens
Radoslav
Telerik team
 answered on 28 Sep 2011
1 answer
167 views
Hello
I have a radgrid in my form.
I also have a radiobutton that control if I want to see the radgrid or not
If Me.RBDestination.SelectedValue = 0 Then 'simple
          Me.TrMultiple.Visible = False
      ElseIf Me.RBDestination.SelectedValue = 1 Then 'multiple
          Me.TrMultiple.Visible = True
      End If
My radgrid is in the TrMultiple <tr>
On the page load I do
If Not IsPostBack = True Then
          RBDestination.SelectedValue = 0
          RBDestination_SelectedIndexChanged(Me, EventArgs.Empty)
  End If
 And my RadioButton looks like this:
<asp:RadioButtonList ID="RBDestination" runat="server" BorderColor="Black" BorderWidth="1" AutoPostBack="true">
            <asp:ListItem Value="0">Destination simple</asp:ListItem>
             <asp:ListItem Value="1">Destination multiple</asp:ListItem>
 </asp:RadioButtonList>
and my radgrid:
<tr id="TrMultiple" runat="server" >
       <td></td>
       <td>
              <telerik:RadGrid 
                   ID="RadGrid2" 
                   Skin="Vista" 
                   runat="server" 
                   ShowFooter="true" 
                  CommandItemStyle-HorizontalAlign="Center" Width="200px">  
                                   
                   <MasterTableView 
                        ShowFooter="true" 
                        CommandItemDisplay="bottom" 
                        EditMode="InPlace" >  
                       <CommandItemTemplate>
                              <asp:LinkButton ID="LinkButton1" CommandName="CalculDistance" Runat="server" CssClass="TexteBlanc16">Calculer</asp:LinkButton>
                       </CommandItemTemplate>
                      <Columns>                     
                           <telerik:GridTemplateColumn UniqueName="CodePostal" HeaderText="Destinations">  
                                 <ItemTemplate>  
                                      <asp:DropDownList ID="LstCodePostal" runat="server"></asp:DropDownList>
                                 </ItemTemplate>  
                          </telerik:GridTemplateColumn>  
                      </Columns>  
               </MasterTableView>  
                                     
     </telerik:RadGrid>

When I click on the radio button to put it visible (value = 1) then I see a little blue line as my radgrid seems to be empty. However, If in my page load I put the radiobutton value to 1, I see my radgrid as It should be..And after that, if I select the value 0 of my radio button and reselect the value 1 to make appear my grid, it shows my grid correctly.
It seems to happens only when I put the radgrid visible to false on page load...
how can i fix it?
Thank you
Princy
Top achievements
Rank 2
 answered on 28 Sep 2011
1 answer
238 views

Hi,

I am using pageview.contentUrl which creates an Iframe with the src attribute. How can I set an iframe ID from the codebehind.

Thanks
Shinu
Top achievements
Rank 2
 answered on 28 Sep 2011
1 answer
178 views
Hello,

  I am trying to access the controls( textbox and dropdown) in template columns in the javascript. The way i am doing is,,,
 var lat = '<%=txtComments.ClientID %>';
                   var lon  = '<%= ddlReason.ClientID %>';

But i am getting a error that those controls are not declared...

I am calling that javascript function like thiss

 <telerik:GridTemplateColumn HeaderText="Reason" UniqueName="Reason" Visible = "false">
        <EditItemTemplate>
          <asp:DropDownList ID="ddlReason" runat="server" ToolTip="Reason"   OnSelectedIndexChanged="NoShowReason(); return    false;" >
 </asp:DropDownList>
</EditItemTemplate>
   </telerik:GridTemplateColumn>

How do i do this????

Appreciate the help
Thanks
Shinu
Top achievements
Rank 2
 answered on 28 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?