Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
298 views
Hi There

I've got a dual combobox which I would like to prepopulate with values from querystring to keep the state persistent.

The problem is that when I load the child dropdown from server side and set the selected value, and then change the parent dropdown from the client side, it does not fire the child dropdown to populate with new values based on parent combo.

Any suggestions?

Here is my code :

<telerik:RadComboBox ID="ddnRegion" runat="server" Skin="Default" OnClientSelectedIndexChanging="LoadTowns" Width="180px" EnableLoadOnDemand="true" /> 
            <br /> 
            <br /> 
            <telerik:RadComboBox ID="ddnTown" runat="server" Width="180px" Skin="Default" EnableLoadOnDemand="true" 
            OnClientItemsRequested="ItemsLoaded" OnItemsRequested="ddnTown_ItemsRequested" /> 
 
 
<script type="text/javascript"
    function LoadTowns(combo, eventarqs) { 
        var townCombo = $find("<%=ddnTown.ClientID%>"); 
        var item = eventarqs.get_item(); 
        townCombo.set_text("Loading..."); 
 
        if (item.get_index() > 0) { 
            townCombo.requestItems(item.get_value(), false); 
        } 
        else { 
            townCombo.set_text(" "); 
            townCombo.clearItems(); 
        } 
    } 
 
    function ItemsLoaded(combo, eventarqs) { 
        var townCombo = $find("<%=ddnTown.ClientID%>"); 
        if (combo.get_items().get_count() > 0) { 
            combo.set_text(combo.get_items().getItem(0).get_text()); 
            combo.get_items().getItem(0).highlight(); 
        } 
        combo.showDropDown(); 
    } 
</script> 


protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!Page.IsPostBack && !Page.IsCallback) 
        { 
            //first populate dropdowns 
            LoadRegions(); 
             
            if (Request.QueryString["region"] != null && Request.QueryString["region"] != "" && Request.QueryString["town"] != null && Request.QueryString["town"] != ""
            { 
                LoadTowns(Request.QueryString["region"]); 
            } 
 
            LoadServices(); 
        } 
    } 
 
void LoadRegions() 
    { 
        CMSManager manager = new CMSManager(dbConn()); 
        ddnRegion.DataSource = manager.GettblRegions(); 
        ddnRegion.DataTextField = "RegionName"
        ddnRegion.DataValueField = "RegionId"
        ddnRegion.DataBind(); 
 
        ddnRegion.Sort = RadComboBoxSort.Ascending; 
        ddnRegion.SortItems(); 
 
        ddnRegion.Items.Insert(0, new RadComboBoxItem("[Select a Region]")); 
 
 
        foreach (RadComboBoxItem item in ddnRegion.Items) 
        { 
            item.ToolTip = item.Text; 
        } 
 
        if (Request.QueryString["region"] != null && Request.QueryString["region"] != ""
        { 
            ddnRegion.SelectedIndex = ddnRegion.Items.IndexOf(ddnRegion.Items.FindItemByValue(Request.QueryString["region"])); 
        } 
    } 
 
    void LoadTowns(string regionId) 
    { 
        CMSManager manager = new CMSManager(dbConn()); 
        ddnTown.DataSource = manager.GettblTownsByRegionID(Convert.ToInt32(regionId)); 
        ddnTown.DataTextField = "TownName"
        ddnTown.DataValueField = "TownId"
        ddnTown.DataBind(); 
 
        ddnTown.Sort = RadComboBoxSort.Ascending; 
        ddnTown.SortItems(); 
 
        ddnTown.Items.Insert(0, new RadComboBoxItem("[Select a Town]")); 
 
        foreach (RadComboBoxItem item in ddnTown.Items) 
        { 
            item.ToolTip = item.Text; 
        } 
 
        if (Request.QueryString["region"] != null && Request.QueryString["region"] != "" && Request.QueryString["town"] != null && Request.QueryString["town"] != ""
        { 
            ddnTown.SelectedIndex = ddnTown.Items.IndexOf(ddnTown.Items.FindItemByValue(Request.QueryString["town"])); 
        } 
    } 
 
    protected void ddnRegion_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) 
    { 
        LoadRegions(); 
    } 
 
    protected void ddnTown_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) 
    { 
        LoadTowns(e.Text); 
    } 


Any help will be appreciated.

Many thanks!


Yana
Telerik team
 answered on 17 Feb 2009
2 answers
110 views
Hi,

Is there any option for RowDoubleClick  event in Server side? if so give some example.

regards
sathies
sathies
Top achievements
Rank 1
 answered on 17 Feb 2009
5 answers
167 views
I am currently testing the RadFormDecorator control in a test form and periodically on postbacks the form would fail to fully render. Mostly occurs when im changing the skin of a particular Control Zone. Any ideas why this might be?

Also another question, how do you set the text properties of a checkbox in CSS? The following code taken from the Default stylesheet does not work:

.radfd_Default .radfdCheckboxText
{
color: #FF2525;
font: normal 8px Verdana, Arial, Sans-serif;
}


Just found this issue:
  1. When using DecoratedControls=Buttons this also updates checkboxes and radio buttons that are within any specified RadFormDecorator DecorationZoneID


Rgds.
Georgi Tunev
Telerik team
 answered on 17 Feb 2009
2 answers
82 views

I am trying to hide specific columns for diferent roles.

The grid is using EditForms mode. With the generated form

What ever I try I can't get the field to not be displayed in the edit form.

If I try and add the columns when needed rather than hide them, then they don't appear as editable boxes in the edit form.
Simon
Top achievements
Rank 1
 answered on 17 Feb 2009
2 answers
154 views
I can't recreate this issue, but it's been happening with my applications.  Files are being named by the path of the uploaded file on the client's machine.  For example, radUpload is trying to save an uploaded file to ~/casefiles/\\S001\scans\filename.pdf from the code below:

in .aspx:
            <telerik:RadUpload runat="server" ID="Radupload1" TargetFolder="~/casefiles" InitialFileInputsCount="3"
            OverwriteExistingFiles="false" OnFileExists="RadUpload1_FileExists" Skin="Skin" EnableEmbeddedSkins="false" />

In .aspx.vb

    Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
            If Radupload1.UploadedFiles.Count > 0 Then
                lblConfirm.Text = "File upload successfully,"
            Else
                lblError.Text = "Please choose at least one file to upload."
            End If
    End Sub

    Protected Sub RadUpload1_FileExists(ByVal sender As Object, ByVal e As Telerik.Web.UI.Upload.UploadedFileEventArgs)
        Dim counter As Integer = 1
        Dim file As UploadedFile = e.UploadedFile
        Dim targetFolder As String = Server.MapPath(RadUpload1.TargetFolder)
        Dim targetFileName As String = Path.Combine(targetFolder, file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension())
        While System.IO.File.Exists(targetFileName)
            System.Math.Max(System.Threading.Interlocked.Increment(counter), counter - 1)
            targetFileName = Path.Combine(targetFolder, file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension())
        End While
        file.SaveAs(targetFileName)
    End Sub

Glenn Boothe
Top achievements
Rank 1
 answered on 17 Feb 2009
4 answers
540 views
Hi,

could you please help me with the following simple case: radcombobox in a repeater:

<asp:DataList ID="repeater" runat="server">
   <ItemTemplate>
      <span><%#DataBinder.Eval(Container.DataItem, "Label")%></span>
      <telerik:RadComboBox runat="server" AutoPostBack="false" DataMember="<%#DataBinder.Eval(Container.DataItem, "Combo")%>" DataTextField="<%#DataBinder.Eval(Container.DataItem, "Text")%>"
DataValueField="<%#DataBinder.Eval(Container.DataItem, "Value")%>" OnDataBinding="comboBinding" />
    </ItemTemplate>
</asp:repeater>

protected void comboBinding(Object sender, EventArgs e)
{
    RadComboBox box = sender as RadComboBox;
    box.DataSource = ds;
    box.ID = string.Format("Filter_{0}", box.DataMember);
}

protected void Page_Load(object sender, EventArgs e)

if (! IsPostBack)
{
    repeater.DataSource = dt;
    repeater.DataBind();
}
else
{
    // here I need to find out what was selected in all those combo boxes
}

I'd like to know the selected values of all combo boxes after PostBack but I can't find out how to do that. I set the IDs of the comboboxes to meaningful values but they probably don't exist yet in the PostBack as Page.FindControl("Filter_xx") didn't find them. How else can I obtain the combo boxes? Should I DataBind the repeater first? I have tried something like that but got an error. Please advise.

Thanks
Matt Jones
Top achievements
Rank 1
 answered on 17 Feb 2009
2 answers
163 views
Hi

When I click to Delete button, open delete confirm window and I click to OK button after return Object reference not set... message to me. I remove  

 

<telerik:GridTemplateColumn HeaderText="Additional Charges" DataField="FeesAdditionalID" Display="false" UniqueName="FeesAdditionalID" >

 

 this column it s now OK. How can I fix it?

 

 <telerik:RadGrid ID="RadGrid1" Skin="Web20"  GridLines="None" runat="server" 
                AllowAutomaticDeletes="True" AllowAutomaticInserts="True" Width="100%" 
                AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="SessionDataSource1" AllowFilteringByColumn="True" AllowSorting="True">  
                <PagerStyle Mode="NextPrevAndNumeric" /> 
                <MasterTableView   Width="100%" CommandItemDisplay="Top" DataKeyNames="ID" 
                    DataSourceID="SessionDataSource1" HorizontalAlign="NotSet">  
                    <Columns> 
 
 <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Delete this item?"  ConfirmDialogType="RadWindow"  Text="Delete" UniqueName="column1">  
                            </telerik:GridButtonColumn> 
                              
                            <telerik:GridEditCommandColumn ButtonType="ImageButton">  
                            </telerik:GridEditCommandColumn> 
 
 <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" EmptyDataText="&amp;nbsp;" HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID">  
                            </telerik:GridBoundColumn> 
 
  <telerik:GridTemplateColumn HeaderText="Additional Charges" DataField="FeesAdditionalID" Display="false" UniqueName="FeesAdditionalID" > 
                                <EditItemTemplate> 
                                     <asp:DropDownList ID="ddlTOC" runat="server" SelectedValue='<%# Bind("FeesAdditionalID") %>' DataTextField="ChargeName" DataValueField="FeesAdditionalID" DataSourceID="sqlFeesAdditional" AppendDataBoundItems="True">  
                                        <asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem> 
                                    </asp:DropDownList> 
                                </EditItemTemplate> 
                            </telerik:GridTemplateColumn> ....  
 
 <asp:SqlDataSource ID="SessionDataSource1"....<DeleteParameters> 
                    <asp:Parameter Name="ID" Type="Int32" /> 
                </DeleteParameters>... 

 

 




ali
Top achievements
Rank 1
 answered on 17 Feb 2009
1 answer
130 views
Hello!

I have grid with allowed filtering. I dynamically change data, but filter row doesn't change. I try to be more specific:

- in the beginning is grid with three columns (date, string, number). The filtering row appears fine
- on the user's action (click in panel bar) I change data. The grid now contains another three columns (for example number, string, string), but filter row is still offering filter for date, string, number and doesn't properly work

So, I am looking for mechanism to ,,refresh,, filter in order to suit to new columns.


Thanks for any input or correction of my way of thinking
Tom

Vlad
Telerik team
 answered on 17 Feb 2009
3 answers
76 views
Hi there,

I am buidling an website that dynamicly populates an RadPanelBar with RadPanelItems. Every RadPanelItem contains an RadEditor. The content from the RadEditor will be dynamicly filled using the RadPanelBar1_ItemClick event. ( i trap the expaned state)

example:
RadPanelItem parent = e.Item;
if (parent.Expanded)
{
    // fill xhtml content from database in radpanelitem
}



Everything works like a charm, but the performance can be better. I want to beable to add some friendly end-user expirience by adding an RadAjaxPanel per RadPanelItem, so when someone clicks an RadPanelItem, the RadEditor will be loaded and filled with content. During this process it will show the end-user an LoadingPanel. Can anyone help me with this?

Thanks!

Mark van den Broek
the Netherlands
Iana Tsolova
Telerik team
 answered on 17 Feb 2009
1 answer
95 views
I have listbox in ascx .cs where i used required field validator for that...i have problem in validator,after insertion of record it shows validator message for that listbox alone...there are other fileds like textbox,dropdown and i used validator for tht but there is no problem in that..


 

<asp:ListBox ID="lstActor" runat="server" CssClass="ComboBox" Width="95%" DataTextField="ArtistName"

 

 

DataValueField="ArtistID" SelectionMode="Multiple"></asp:ListBox>

 

 

<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ControlToValidate="lstActor"

 

 

ErrorMessage="Please Select Actor" Text="*"></asp:RequiredFieldValidator>


 

<

asp:ValidationSummary runat="server" ID="ValidationSummary" HeaderText="Please correct the following errors:" />

 

Vlad
Telerik team
 answered on 17 Feb 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?