Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
182 views
I'm trying to make my RadRotator item vertical scrollable in case the div overflow but it seem to render as hidden.
How should I style the div in my ItemTemplate?
See page snipplet below:

<telerik:RadRotator ID="radRotator1" runat="server" EnableViewState="true"
    Width="940px" Height="550px"
    ItemWidth="900px" 
    BorderStyle="None" BorderWidth="0" BorderColor="Transparent"  
    WrapFrames="true"
    ScrollDirection="Left, Right" RotatorType="SlideShowButtons"
    OnItemDataBound="radRotator1_ItemDataBound" >
    <ItemTemplate>
    <div style="overflow:scroll;">
       <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" 
            ShowHeader="true" ShowFooter="false">             
        <Columns>
        ...
        </Columns>
</asp:GridView>
    <asp:Panel ID="pnlTest1" runat="server" Visible="false"> Panel content test. </asp:Panel>     </div>     </ItemTemplate> </telerik:RadRotator>
Gibson Wong
Top achievements
Rank 1
 answered on 19 Sep 2011
2 answers
95 views
Hi,

I have a custom Dropdown tool (telerik:EditorDropDown)in my RadEditor. I know how to get the selected value/text from client side using Javascript. But how can I get the selected value from Server side (C#)?

Thanks
Ning
Ning
Top achievements
Rank 1
 answered on 19 Sep 2011
4 answers
64 views

Hi,

When I click on addNewItem Of  rad Frid.
How to place the Focus on First Control of inserted
If column  is GridBound Column like as follows

 

<telerik:GridBoundColumn DataField="Address1" UniqueName="Address1" HeaderText="<%$ Resources:lbl_Employee_Address1 %> " ShowFilterIcon="false"

 

 

EditFormColumnIndex="0" Visible="false" >

 

 

</telerik:GridBoundColumn>

 



Could some one please help me regarding this.

I really appreciate it.
Thanks in advance

--Prathyusha
prathyusha
Top achievements
Rank 1
 answered on 19 Sep 2011
5 answers
428 views
I have this layout:

<RadGrid>
   <MasterTableView>
      <CommandItemTemplate>
         <RadToolBar>

How can I "find" the radtoolbar to disable buttons?  I can do a "myControl.FindControl("myGrid")... but i cannot find the toolbar do enable/disable it.  I can also do a grid.MasterTableView.GetColumn("myButton").Visible = false but again, can't seem to "find" the toolbar or it's buttons.
Jayesh Goyani
Top achievements
Rank 2
 answered on 19 Sep 2011
1 answer
84 views
Hello,

I'm trying to move the page of my grid when my page loads. At the moment I'm able to load the correspondent data to the page I want to move, however the pagination control remains always in the page number one.

Any help?

Thanks
Amaro Barros
Princy
Top achievements
Rank 2
 answered on 19 Sep 2011
0 answers
114 views
This gave me fits, perhaps it can be useful to someone else.

The problem was that I have one page where the user can select from a drop down to edit one of a number of different reference tables in the grid.  They select a table, and the datasource and grid are rebound to that particular table.

Part of the problem then is limiting their input to the proper length for each field.

Unfortunately the sqldatasource doesn't preserve the underlying SQL types, at least not that I could find.  It converts varchars to a "string" type.  So there is no field length available.

So we retrieve the schema data separately from the DB.  Where lstReference is the list box they select the table to edit from, and the value contains the table name.  Note that it's only getting the length for the varchar and nvarchar fields.  Those are the only ones I'm interested in here, but you could certainly modify that to your needs.
private void GetSchema()
{
    // Clear the list out.
    _charFieldLength.Clear();
    DataTable dt = new DataTable();
    string connString = Util.GetConnectionString();
    SqlConnection conn = new SqlConnection(connString);
    conn.Open();
      
    try
    {
        // Retrieve the schema info from the DB.
        string[] restriction = { Util.GetDBName(), null, lstReference.Items[lstReference.SelectedIndex].Value, null };
        dt = conn.GetSchema("Columns", restriction);
    }
    catch (Exception ex)
    {
        // Log error
    }
    finally
    {
        if (conn.State == ConnectionState.Open)
            conn.Close();
    }
    // Populate the list with the schema info we're interested in.
    foreach (DataRow row in dt.Rows)
    {
        if (row["DATA_TYPE"].ToString() == "varchar" || row["DATA_TYPE"].ToString() == "nvarchar")
        {
            FieldInfo fi = new FieldInfo();
            fi.FieldName = row["COLUMN_NAME"].ToString();
            fi.DataLength = int.Parse(row["CHARACTER_MAXIMUM_LENGTH"].ToString());
            _charFieldLength.Add(fi);
        }
    }
}


And we can store that information in a list of these structs, just the field name and length.
private struct FieldInfo
{
    public string FieldName;
    public int DataLength;
    public FieldInfo(string fieldName, int dataLength)
    {
        FieldName = fieldName;
        DataLength = dataLength;
    }
}
List<FieldInfo> _charFieldLength = new List<FieldInfo>();


And this took me a while to weed out, but I did find a Telerik example that I was able to finally use to get a reference to the auto generated edit text boxes to be able to actually set the MaxLength.  This works for both Edit and Insert.
protected void gridActivity_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem form = (GridEditableItem)e.Item;
        for (int i = 0; i < _charFieldLength.Count; i++)
        {
            TextBox dataField = (TextBox)form[_charFieldLength[i].FieldName].Controls[0];
            dataField.MaxLength = _charFieldLength[i].DataLength;
        }
    }
}
Marbry
Top achievements
Rank 1
 asked on 19 Sep 2011
1 answer
78 views
I am not sure if that will be the right place to ask.
I am writing a asp.net composite server control, which will have a RadGrid as part of it. I don't want to expose the whole grid as a public property though, instead I would like to expose just GridColumnCollection part. 

GridColumnsCollection is a read-only property though so I can't write the code below:
[
    Category("Grid"),
    Description("Columns for a grid."),
    DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
    PersistenceMode(PersistenceMode.InnerProperty)
]
public GridColumnCollection GridColumns
{
    get
    {
        EnsureChildControls();
        return grid.MasterTableView.Columns;
    }
    set
    {
        EnsureChildControls();
        grid.MasterTableView.Columns = value;
    }
}

When I am trying to change it to something like the code below, I will get an error saying that GridColumnCollection does not have constructor which takes 0 arguments.
    Category("Grid"), 
    Description("Columns for a grid."), 
    DesignerSerializationVisibility(DesignerSerializationVisibility.Content), 
    PersistenceMode(PersistenceMode.InnerProperty) 
public GridColumnCollection GridColumns 
    get 
    
        EnsureChildControls(); 
        return grid.MasterTableView.Columns; 
    
    set 
    
        EnsureChildControls(); 
        foreach(GridColumn col in value)
        {
                 grid.MasterTableView.Columns.Add(col); 
        }
    
}

Is there any way to expose just columns from RadGrid as a property of a composite server control?

Thanks,

Daniel
Daniel
Top achievements
Rank 1
 answered on 19 Sep 2011
3 answers
694 views
Hi,
I explain my situation.
I have a grid with many template columns.
One template column (uniquename: "ValoreTextBoxComboBox")  has two controls  a label ("LabelDescrizioneI") binded and a radcombobox ("RadComboBoxValore") not binded. 
Then programmatically  "OnItemDatabound " event  of the radgrid i decided which control is visible and in case this control is the radcombobox i bind it.
Everything works until i click "Edit" on the radgrid, the combobox lost everithing ( data and selectedvalue) .

<telerik:RadGrid ID="rdgParamDatiAziendali" AllowPaging="true" DataSourceID="edsGridParam" runat="server" OnUpdateCommand="rdgParamDatiAziendalie_UpdateCommand"
           GridLines="None" Width="97%" AllowSorting="true" PageSize="20" OnItemDataBound ="rdgParamDatiAziendali_ItemDataBound">    
        <MasterTableView AutoGenerateColumns="False" EditMode="InPlace" DataKeyNames="IdConfigurazioneProgrammaCultura"
           OverrideDataSourceControlSorting="true" TableLayout="Auto">
           <CommandItemTemplate>
           </CommandItemTemplate>
                                                                                                                                                                                                                                                                                           <Columns
          <telerik:GridEditCommandColumn ButtonType="ImageButton" CancelImageUrl="~/Images/ImagesGrid/Cancel.gif"
               EditImageUrl="~/Images/ImagesGrid/Edit.gif" UpdateImageUrl="~/Images/ImagesGrid/Update.gif"
               InsertImageUrl="~/Images/ImagesGrid/Update.gif" UniqueName="EditCommandColumn"
               ItemStyle-Width="50px" HeaderStyle-Width="50px" />
           <telerik:GridBoundColumn DataField="IdCultura" DataType="System.Int64" HeaderText="IdCultura"
               SortExpression="IdCultura" UniqueName="IdCultura" ReadOnly="true" Visible="false">
           </telerik:GridBoundColumn>
           <telerik:GridBoundColumn DataField="IdConfigurazioneProgrammaCultura" DataType="System.Int64" HeaderText="Id" SortExpression="IdConfigurazioneProgrammaCultura"
               UniqueName="IdConfigurazioneProgrammaCultura" Display="false">
           </telerik:GridBoundColumn>                       
            <telerik:GridBoundColumn DataField="Descrizione" DataType="System.String" HeaderText="Descrizione" SortExpression="Descrizione"
               UniqueName="Descrizione"  ReadOnly="true" HeaderStyle-Width="405px" ItemStyle-Height="13px"
           </telerik:GridBoundColumn>
           <mwc:GridBoundColumn DataField="Id" DataType="System.Int64" HeaderText="Id" SortExpression="Id"
               UniqueName="Id" Display="false"></mwc:GridBoundColumn
                <mwc:GridBoundColumn DataField="IdParametroAzienda" DataType="System.Int64" HeaderText="IdParametroAzienda" SortExpression="IdParametroAzienda"
               UniqueName="IdParametroAzienda" Display="false">
           </mwc:GridBoundColumn>
              <telerik:GridTemplateColumn Resizable="true" HeaderStyle-Width="275px" UniqueName="ValoreTextBoxComboBox"
                   SortExpression="ValoreTextBoxComboBox" ItemStyle-Height="13px">
                   <HeaderTemplate>
                       <mwc:Label ID="LabelUnificata" runat="server" LabelResources="valore_simi"
                           ParentType="RadGrid" Height="13px"></mwc:Label>
                   </HeaderTemplate>
                   <ItemTemplate>
                       <mwc:Label ID="LabelDescrizioneI" runat="server" Text='<%# Bind("DescrizioneTextBox") %> '
                           Width="270px" ReadOnly="true" ParentType="RadGrid" Height="13px"></mwc:Label>
                       <telerik:RadComboBox ID="RadComboBoxValore" runat="server" Width="270px" AutoPostBack="false"
                           ParentType="RadGrid" ReadOnly="true" Height="13px">
                       </telerik:RadComboBox>
                       <mwc:HiddenField ID="HiddenFieldQueryRiga" runat="server" Value='<%# Bind("QueryComboBox") %>' />
                       <mwc:HiddenField ID="HiddenFieldTipoControllo" runat="server" Value='<%# Bind("IdTipoParametro") %>' />
                       <mwc:HiddenField ID="HiddenFieldSelectedValueRadComboBoxValore" runat="server" Value='<%# Bind("ValoreComboBox") %>' />
                   </ItemTemplate>
                   <EditItemTemplate>
                       <mwc:TextBox ID="TextBoxDescrizione" runat="server" Width="300px" Text='<%# Bind("DescrizioneTextBox") %>'></mwc:TextBox>
                       <telerik:RadComboBox ID="RadComboBoxValore" runat="server" Width="300px" AutoPostBack="false">
                       </telerik:RadComboBox>
                       <mwc:HiddenField ID="HiddenFieldQueryRiga" runat="server" Value='<%# Bind("QueryComboBox") %>' />
                       <mwc:HiddenField ID="HiddenFieldTipoControllo" runat="server" Value='<%# Bind("IdTipoParametro") %>' />
                       <mwc:HiddenField ID="HiddenFieldSelectedValueRadComboBoxValore" runat="server" Value='<%# Bind("ValoreComboBox") %>' />
                   </EditItemTemplate>
               </telerik:GridTemplateColumn>
               <mwc:GridTemplateColumn Resizable="false" HeaderStyle-Width="60px" UniqueName="Abilitato"
                   ItemStyle-Height="13px">
                   <HeaderTemplate>
                       <mwc:Label ID="LabelAbilitato" runat="server" LabelResources="abilitato_simi"
                           ParentType="RadGrid" Width="60px" Height="13px"></mwc:Label>
                   </HeaderTemplate>
                   <ItemTemplate>
                       <div style="text-align: center;">
                           <mwc:CheckBox ID="CheckBoxAbilitatoI" runat="server" Checked='<%# Bind("Abilitato") %>'
                               Enabled="false" Width="55px" Height="13px" />
                       </div>
                   </ItemTemplate>
                   <EditItemTemplate>
                       <mwc:CheckBox ID="CheckBoxAbilitatoE" runat="server" Checked='<%# Bind("Abilitato") %>'
                           Width="55px" Height="13px" />
                   </EditItemTemplate>
               </mwc:GridTemplateColumn>
       </Columns
       </MasterTableView
       </telerik:RadGrid>

The c# code:
protected void rdgParamDatiAziendali_ItemDataBound(object source, GridItemEventArgs e)
   {
       GridDataItem dataBoundItem = e.Item as GridDataItem;
       if (!(e.Item is GridDataInsertItem) && e.Item.IsInEditMode)
       //item is about to be edit  
       {
           long tipoParametro = long.Parse(((HiddenField)e.Item.FindControl("HiddenFieldTipoControllo")).Value);
           if (tipoParametro == (int)CommonParameters.TipoParamDatiAziendali.CheckBox_ComboBox || tipoParametro == (int)CommonParameters.TipoParamDatiAziendali.ComboBox)
               //RadComboBoxValore load values and selectedvalue
           ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).DataSource = Utility.ValoriComboBox(((HiddenField)e.Item.FindControl("HiddenFieldQueryRiga")).Value, long.Parse(hdfIdCultura.Value));
           ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).DataValueField = "Valore";
           ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).DataTextField = "Descrizione";
           ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).SelectedValue = ((HiddenField)e.Item.FindControl("HiddenFieldSelectedValueRadComboBoxValore")).Value;
           try
           {
               ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).DataBind();
           }
           catch (ArgumentOutOfRangeException exc)
           {
               ErrorMessage.generatePopUpError(RadWindowErrori, ((SessionInformation)Session["sessionData"]).IdCultura, exc, null);
           }
           try
           {
               switch (tipoParametro)
               {
                   case (int)CommonParameters.TipoParamDatiAziendali.CheckBox :
                       //CheckBox
                       ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).Visible = false;
                       ((TextBox)e.Item.FindControl("TextBoxDescrizione")).Visible = false;
                       ((CheckBox)e.Item.FindControl("CheckBoxAbilitatoE")).Visible = true;
                       break;
                   case (int)CommonParameters.TipoParamDatiAziendali.CheckBox_ComboBox :
                       //CheckBox-ComboBox
                       ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).Visible = true;
                       ((TextBox)e.Item.FindControl("TextBoxDescrizione")).Visible = false;
                       ((CheckBox)e.Item.FindControl("CheckBoxAbilitatoE")).Visible = true;
                       break;
                   case (int)CommonParameters.TipoParamDatiAziendali.TextBox :
                       //TextBox
                       ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).Visible = false;
                       ((TextBox)e.Item.FindControl("TextBoxDescrizione")).Visible = true;
                       ((CheckBox)e.Item.FindControl("CheckBoxAbilitatoE")).Visible = false;
                       break;
                   case (int)CommonParameters.TipoParamDatiAziendali.ComboBox :
                       //ComboBox
                       ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).Visible = true;
                       ((TextBox)e.Item.FindControl("TextBoxDescrizione")).Visible = false;
                       ((CheckBox)e.Item.FindControl("CheckBoxAbilitatoE")).Visible = false;
                       break;
                   case (int)CommonParameters.TipoParamDatiAziendali.CheckBox_TextBox :
                       //CheckBox-TextBox
                       ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).Visible = false;
                       ((TextBox)e.Item.FindControl("TextBoxDescrizione")).Visible = true;
                       ((CheckBox)e.Item.FindControl("CheckBoxAbilitatoE")).Visible = true;
                       break;
               }
           }
           catch (NullReferenceException)
           {
           }
             
       }
       else if (e.Item is GridDataItem)
       {
           //RadComboBoxValore load values and selectedvalue
           if (!String.IsNullOrEmpty(((HiddenField)e.Item.FindControl("HiddenFieldQueryRiga")).Value) && (((HiddenField)e.Item.FindControl("HiddenFieldTipoControllo")).Value == "4"))
           {
               ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).DataSource = Utility.ValoriComboBox(((HiddenField)e.Item.FindControl("HiddenFieldQueryRiga")).Value, 0);
               ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).DataValueField = "Key";
               ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).DataTextField = "Value";
               ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).SelectedValue = ((HiddenField)e.Item.FindControl("HiddenFieldSelectedValueRadComboBoxValore")).Value;
               ((Label)e.Item.FindControl("LabelDescrizioneI")).Visible = false;
               ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).DataBind();
           }
           else
           {
               ((RadComboBox)e.Item.FindControl("RadComboBoxValore")).Visible = false;
           }
       }
   }

I really don't understand why the radcombobox lost everithing when i click the Edit column. I used the same tecniche to fill the combo if " IsInEditMode" or  if (e.Item is GridDataItem).

Thanks everybody !!!!

 

archimede
Top achievements
Rank 1
 answered on 19 Sep 2011
2 answers
85 views
I have one GridBoundColumn in a RadGrid where I don't want this functionality.  Is there a way to disable it on one column?

Thanks,

Kent
Kent
Top achievements
Rank 1
 answered on 19 Sep 2011
0 answers
73 views
hi telerik team

How to post uploaded files to another ip using multiple file selecion,
Ferrdins
Top achievements
Rank 1
 asked on 19 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?