Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
119 views
I'm having a logic issue.  I have some Comboboxes that I need to cascade while in Edit or Insert Mode.  The problem is when I Bind the second Combo based on the first, the entire Grid does a PostBack and so the Combos rebind again.

I know i'm likely just missing an 'If Postback' or something, but my brain is mush right now.

 

<telerik:RadGrid ID="RecipientsGrid" runat="server" AutoGenerateColumns="false" EnableViewState="true" PageSize="5" AllowFilteringByColumn="true" AllowPaging="true" AllowSorting="True">

<EditFormSettings EditFormType="Template">

<FormTemplate>

<telerik:RadComboBox ID="CountryCombo" runat="server">

 

</telerik:RadComboBox>

<telerik:RadComboBox ID="ProvinceCombo" runat="server" Width="325" >

</telerik:RadComboBox>

</FormTemplate>

</EditFormSettings>

</telerik:RadGrid>


    Private Sub RecipientsGrid_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RecipientsGrid.ItemDataBound
 
        If TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode Then
            Dim editItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
            Dim ProvinceCombo As RadComboBox = TryCast(editItem.FindControl("ProvinceCombo"), RadComboBox)
            Dim CountryCombo As RadComboBox = TryCast(editItem.FindControl("CountryCombo"), RadComboBox)
            Dim CityCombo As RadComboBox = TryCast(editItem.FindControl("CityCombo"), RadComboBox)
            '** Populate ComboBoxes and define their Default Value
            Using context As New DataEntities
                With CountryCombo
                    .DataValueField = "CountryId"
                    .DataTextField = "CountryName"
                    .DataSource = context.Countries.OrderBy(Function(x) x.displayOrder).ToList
                End With
                CountryCombo.Width = Unit.Pixel(320)
                CountryCombo.DataBind()
            End Using
 
            Using context As New DataEntities
                With ProvinceCombo
                    .DataValueField = "ProvinceId"
                    .DataTextField = "NameEnglish"
                    .DataSource = context.Provinces.Where(Function(x) x.CountryId = CountryId).OrderBy(Function(x) x.NameEnglish).ToList
 
                End With
                ProvinceCombo.Width = Unit.Pixel(320)
                ProvinceCombo.DataBind()
            End Using
 
 
            Using context As New DataEntities
                With CityCombo
                    .DataValueField = "CityId"
                    .DataTextField = "CityName"
                    .DataSource = context.Cities.Where(Function(x) x.ProvinceID = ProvinceId).OrderBy(Function(x) x.CityName).ToList
                End With
                CityCombo.Width = Unit.Pixel(320)
                CityCombo.DataBind()
            End Using
            SetComboBoxDefault(CountryId, CountryCombo, "Country")
            SetComboBoxDefault(ProvinceId, ProvinceCombo, "Province/State")
            SetComboBoxDefault(CityId, CityCombo, "City")
 
 
        End If
 
 
    End Sub
 
    Public Sub SetComboBoxDefault(ByVal FindItemByValue As Integer, ByVal Control As RadComboBox, ByVal DisplayText As String)
 
        Dim ComboBoxItem As RadComboBoxItem
 
        If FindItemByValue >0 Then
            ComboBoxItem = Control.FindItemByValue(FindItemByValue)
            ComboBoxItem.Selected = True
 
        Else
            Control.Items.Insert(0, New RadComboBoxItem("-- Please select a " & DisplayText & " --", String.Empty))
        End If
 
    End Sub
 
    Private Sub RecipientsGrid_ItemCreated(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RecipientsGrid.ItemCreated
If TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode Then
 
            'if the item is in edit mode
            Dim editItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
            Dim CountryCombo As RadComboBox = DirectCast(editItem.FindControl("CountryCombo"), RadComboBox)
            CountryCombo.AutoPostBack = True
 
            AddHandler CountryCombo.SelectedIndexChanged, AddressOf CountryCombo_SelectedIndexChanged
 
        End If
 
 
    End Sub
 
    Protected Sub CountryCombo_SelectedIndexChanged(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
 
        If RecipientsGrid.MasterTableView.IsItemInserted <> False Then
 
            Dim insertItem As GridEditFormInsertItem = DirectCast(TryCast(sender, DropDownList).NamingContainer, GridEditFormInsertItem)
 
            Dim ddlList As DropDownList = DirectCast(insertItem.FindControl("Dropdownlist2"), DropDownList)
        Else
 
            Dim CountryCombo As RadComboBox = DirectCast(sender, RadComboBox)
            Dim editedItem As GridEditableItem = DirectCast(TryCast(sender, RadComboBox).NamingContainer, GridEditableItem)
            Dim ProvinceCombo As RadComboBox = DirectCast(editedItem.FindControl("ProvinceCombo"), RadComboBox)
 
            Using context As New DataEntities
                With ProvinceCombo
                    .DataValueField = "ProvinceId"
                    .DataTextField = "NameEnglish"
                    .DataSource = context.Provinces.Where(Function(x) x.CountryId = e.Value).OrderBy(Function(x) x.NameEnglish).ToList
                End With
                ProvinceCombo.Width = Unit.Pixel(320)
                ProvinceCombo.DataBind()
            End Using
 
        End If
 
    End Sub





Tsvetoslav
Telerik team
 answered on 22 Oct 2012
4 answers
138 views
I used radgrid view for display some of my data and using that rad view. I need to do two things
1. delete some records - need ajax manager
2. stream to web browser - need to disable ajax manager.

here is my code snipts 

<script type="text/javascript">
            function requestStart(sender, args) {
                if (args.get_eventTarget().indexOf("GD") > 0)
                    args.set_enableAjax(false);
            }
</script>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="requestStart">

in the grid
<%--<telerik:GridButtonColumn ButtonType="LinkButton" Text="<img src='../App_Themes/default/images/genDoc.gif' border='0' title='Generate Document'/>" UniqueName="GD" CommandName="G"></telerik:GridButtonColumn>--%>


<telerik:GridTemplateColumn HeaderText="" UniqueName="Image">
<ItemTemplate>
<asp:ImageButton ID="GD" runat="server" ImageUrl="~/App_Themes/Default/images/genDoc.gif" CommandName="1" OnClick="ImageButton1_Click">
</
asp:ImageButton>         
</
ItemTemplate><br></telerik:GridTemplateColumn>

in the code behind

  protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
          if (e.CommandName == "G")
            {
                genDoc(e.Item.ItemIndex);
            }
        }

        protected void ImageButton1_Click(object sender, EventArgs e)                   //method 2
        {
            genDoc(0);
        }

If I use the commented link button thing it will go to the method run method well but not give me download a file. 
If I use image button it works well and I can download a file, but I cant get particular index to my method(e.Item.ItemIndex
)...{in the genDoc() - document.Save("Sample.doc", FormatType.Doc, Response, HttpContentDisposition.Attachment); }

any way what I want to pass e.Item.ItemIndex value to my method genDoc(int index)...Please help me. thanks

Shinu
Top achievements
Rank 2
 answered on 22 Oct 2012
3 answers
1.0K+ views
I'm having a hard time getting all of the column names for a tree list with javascript

I can call get_columns() and get an array of objects back, but they don't seem TreeListColumn objects - I can't call get_uniqueName() on them. I've dug around in the objects a bit in the debugger and I don't see the unique name in there at all.

Am I doing something wrong?
Princy
Top achievements
Rank 2
 answered on 22 Oct 2012
2 answers
544 views
Hi All,

           I am using RadAsyncUpload control in my program. I wanted to reduce the size of text box which comes with asyncupload control. Is it possible??? Here is my sample code.

<telerik:RadAsyncUpload runat="server" AllowedFileExtensions="jpg,png" ID="rdUploadImage" MultipleFileSelection="Disabled" MaxFileInputsCount="1" ControlObjectsVisibility="None" Width="1px" OnClientFileUploaded="ImageFileUploaded" InputSize="40" >
  <Localization Select="Browse" />
  </telerik:RadAsyncUpload>
  <style type="text/css">
  .RadUpload  .ruRemove 
  {
      display:none;
  }
  </style>

If anybody knows, kindly let me know the solution. Thanks in advance.
Geetha
Top achievements
Rank 1
 answered on 22 Oct 2012
1 answer
285 views
Hola,


      Hay alguna forma de globalizar el idioma de los controles al español?


Saludos.


Miguel Santiago
Kate
Telerik team
 answered on 22 Oct 2012
1 answer
45 views
Hi Is there one place I can go to find a list of enhancements to the rad Ajax controls since the Q2 2010 release. (As far as web development is concerned). I am trying to assess the benefit of upgrading to a more recent release for my business. Thanks Clive
Eyup
Telerik team
 answered on 22 Oct 2012
0 answers
74 views

Hello

I am considering such scenario - one web service for appointments and multi-client schedulers.
I have created asp.net page with radscheduler and webservice binding.
Now I am trying to use this web service for winforms scheduler (I am performing some operations in web service so solution with direct db access is unacceptable for me and I would like to have everything in one piece, in web service).
So I am trying to get appointments from this web service - unfortunately it is JSON service so it is not so easy..
I can't deserialize such method in forms client

public List<AppointmentData> GetJSONScheduler(SchedulerInfo schedulerInfo)

 

I am suceesfully invoke this method (but I have to make some modifications in JSON string before send it) and I can't deserialize return List
I have been trying:

DataContractJsonSerializer dJSON = new DataContractJsonSerializer(typeof(List<AppointmentData>);
 
List<AppointmentData> sr = (List<AppointmentData>)dJSON.ReadObject(str);
 
//str is response from HttpWebResponse
 
  
 
JavaScriptSerializer jscriptDeserializer = new JavaScriptSerializer();
 
 jscriptDeserializer.RecursionLimit = 100;
 
 List<AppointmentData> srResult = jscriptDeserializer.Deserialize<List<AppointmentData>>(sbResponse.ToString());
 
//sbResponse is StringBuilder made from GetResponseStream() of HttpWebResponse

 

Do you have any advices?

Thanks in advance
Regards

Michał
Top achievements
Rank 1
 asked on 22 Oct 2012
0 answers
55 views

I created two web solutions, A and B. And I added a data entry web form (DataEntery.aspx) into Solution A, with third party user controls and form authentication.

I want to use the web page DataEntery.aspx into solution B. What is the best method for it?

Shajan
Top achievements
Rank 1
 asked on 22 Oct 2012
5 answers
149 views
After installing your latest version of Telerik Rad Ajax Controls RadControlsForAspNetAjaxControlPanel_2012_3_1016.exe (and no other upgrades to the other products)...
When I open an existing project that uses Telerik in Visual Studio 2010, it immediately gives the error that Visual Studio has stopped working and kicks me out.

However, if I open Visual Studio without an existing project, it opens fine.

This occurred right after installing your project and having done nothing else and happens to all 4 of my projects that use Telerik.

Ack!

Please help. How do I back out and get the previous version?

thanks.
Biliana Ficheva
Telerik team
 answered on 22 Oct 2012
1 answer
57 views
Hi All,

I am using ClientEvents-OnRowSelected function in radgrid. and using Webservice method in that client events. all browsers working fine. but Safari only doesn't calling that webservice method in only OnRowSelected method. but in same page i am using various function this webservice method working Safari also. Please check and let me know why it's not calling that particular method.

Please let me know.


Thanks in Advance,
Dhamodharan.S
Radoslav
Telerik team
 answered on 22 Oct 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?