Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
1.0K+ views
I have a grid which I bind to a DataTable in page_load.  I want to programatically select the first row in the grid after I bind the data to the grid - the data binding is done server side by populating a DataTable.  My grid is defined as :-

<telerik:RadGrid ID="gridParts" runat="server" AllowSorting="True" CellSpacing="0" Height="690px" OnSelectedIndexChanged="gridParts_SelectedIndexChanged" AllowMultiRowSelection="False">
<ClientSettings>
<Selecting AllowRowSelect="True" />
</ClientSettings>
<MasterTableView AutoGenerateColumns="true" TableLayout="Fixed" DataKeyNames="PartNumber" AllowCustomSorting="false" AllowMultiColumnSorting="false" AllowNaturalSort="false" Alloo>
</MasterTableView>
<ClientSettings Selecting-AllowRowSelect="true" EnablePostBackOnRowClick="true">
<Resizing AllowColumnResize="true" ResizeGridOnColumnResize="false" AllowResizeToFit="true" ClipCellContentOnResize="true" EnableRealTimeResize="true" />
<Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" />
</ClientSettings>
</telerik:RadGrid>

Note that I have enabled selection but disabled multi-row selection.  In my C# I do the following

// Data source for parts grid
gridParts.DataSource = partsTable;

// set initial sorting on the Part Number
GridSortExpression sort = new GridSortExpression();
sort.SortOrder = GridSortOrder.Ascending;
sort.FieldName = "PartNumber";
gridParts.MasterTableView.SortExpressions.AddSortExpression(sort);

// Select the first part (if any)
if (gridParts.Items.Count != 0)
gridParts.Items[0].Selected = true;

What happens now is odd - I don't see any visible sign that the first part has been selected however the grid is in an odd state.  In my gridParts_SelectedIndexChanged handler I have the following code :-

protected void gridParts_SelectedIndexChanged(object sender, EventArgs e)
{
if (gridParts.SelectedItems != null && gridParts.SelectedItems.Count > 0)
{
GridDataItem dataItem = gridParts.SelectedItems[0] as GridDataItem;
string partNumber = (string)dataItem.GetDataKeyValue("PartNumber");
DWPart part = DWPart.FindByName(partNumber);
DisplayComponents(part.ID);
}
}

What is odd is that the partNumber ALWAYS is the first item in the grid, even when I have scrolled down and selected another item.  Simple removing the line which sets the initial selection fixes the problem and the grid selection works correctly - buit I want to always have an item selected as the selected item causes a second grid to be populated.

Princy
Top achievements
Rank 2
 answered on 09 Jan 2012
1 answer
117 views
Hi,

       How can we change the background image/Color of tab strips. i need to change Hover, selected and Tabs normal back ground to color which is matching to our web app. is there any way means please tell me. I tried changed css properties. but the background image is not changing.


Thanks
Rajeev
Princy
Top achievements
Rank 2
 answered on 09 Jan 2012
1 answer
211 views
Please help

I have the following situation:

radgrid with custom template and editmode set to editformtype="template" and editmode="editforms". Also, defined

 

OnUpdateCommand="RadGrid2_UpdateCommand

for the first version and

OnItemCommand="RadGrid1_ItemCommand"

for the second version.

First I put radgrid item in editmode with first button:

RadGrid2.EditIndexes.Add(0);
RadGrid2.Rebind();


On the second button I am trying to bubble grid update from button control that is outside the radgrid like this:
if (commandButton.CommandName.ToLower() == "update")
            {
                foreach (GridEditFormItem item in RadGrid2.MasterTableView.GetItems(GridItemType.EditFormItem))
                {
                   RadGrid2.MasterTableView.PerformUpdate(item, true); // first version
                   item.FireCommandEvent("Update", string.Empty); //second version
                }

The corresponding event handlers bubble but I can`t get values from custom template radtextboxes:

 

<EditFormSettings EditFormType="Template" >
                            <EditColumn UniqueName="EditColumn"></EditColumn>
 <FormTemplate>
                                    <div>
                                        <tr>
                                            <td>
                                                Inicijali
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="Inicijali" runat="server" Font-Names="Verdana" Font-Size="Small"
                                                    Text='<%# Bind("Inicijali") %>'>
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Kratica imena
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="KraticaImena" runat="server" Font-Names="Verdana" Font-Size="Small"
                                                    Text='<%# Bind("KraticaImena") %>'>
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>.....</table>

RadGrid definition:

<telerik:RadGrid ID="RadGrid2" runat="server" DataSourceID="DetailsViewSQLDataSource"
                        AutoGenerateColumns="false" OnUpdateCommand="RadGrid2_UpdateCommand" OnItemCommand="RadGrid1_ItemCommand"
                        AllowAutomaticUpdates="true">
                        <MasterTableView DataSourceID="DetailsViewSQLDataSource" AutoGenerateColumns="true"
                            DataKeyNames="IdOsobe" ShowHeader="false" EditMode="EditForms" AllowAutomaticInserts="true">

I tried like this:

protected void RadGrid2_UpdateCommand(object sender, GridCommandEventArgs e)
       {
           if (e.CommandName == RadGrid.UpdateCommandName)
           {
               if (e.Item is GridEditFormItem)
               {
                   GridEditFormItem item = (GridEditFormItem)e.Item;
                   int id = Convert.ToInt32(item.GetDataKeyValue("IdOsobe"));
                   if (id != 0)
                   {
                       RadTextBox txtInicijali =
                          (RadTextBox)item.FindControl("Inicijali");
 
                       RadGrid1.Rebind();
                   }
               }
           }
 
       }

But the value of txtInicijali.text is always string.empty.

How can get values from custom template?

Is there a better way to accomplish update from button outside the radgrid?

Another problem that I have:

I have defined <ItemTemplate></ItemTemplate> and <FormTemplate> and grid is in edit mode it shows both templates - does not hide itemtemplate! I want to item template and editformtemplate be the same.


Please help!
Shinu
Top achievements
Rank 2
 answered on 09 Jan 2012
1 answer
49 views
Hi,

How give a parent node an other icon than a plus or minus when it is having no children?
No my treeview is given no icon for items which having no children.

Regards,
Wouter Splinter
Princy
Top achievements
Rank 2
 answered on 09 Jan 2012
1 answer
173 views
HI there,

Screenshot is attached , RadGrid is now showing Add New Record and refresh buttons, and text is also not displaying correctly.
2011-Q3-Nov 
Shinu
Top achievements
Rank 2
 answered on 09 Jan 2012
1 answer
83 views
I have a RadGrid on my page with the Vista theme and there are absolutely no fonts specified anywhere.  So it's just picking up the default fonts (from the theme, I assume).  The fonts seem to be Arial or a variation of it.

When I export the grid to PDF, the fonts on the generated file are Times New Roman.

What do I have to do to have the PDF match the grid?
I am using RadControls for ASP.NET AJAX Q1 2011.
Princy
Top achievements
Rank 2
 answered on 09 Jan 2012
0 answers
128 views
I've read many of the threads on the forum concerning this issue, but they are very confusing and seem to focus on .net 4.

I am trying to use Ajax control toolkit 3.5 (version: 3.5.51116.0) with Telerik version 2010.1.519.35.  I have a masterpage with a RadScriptManager and I'm getting this error:

Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "AjaxControlToolkit.Properties.Resources.resources" was correctly embedded or linked into assembly "AjaxControlToolkit" at compile time, or that all the satellite assemblies required are loadable and fully signed.



Are these two versions not compatible?
Troy
Top achievements
Rank 1
 asked on 08 Jan 2012
2 answers
234 views
Hi,

I am using the latest version of Telerik Controls for Asp .net.
I'd like to know how to get the title of RadWindow aligned left.
Currently the title is shown at the center of the title bar.
Here is my code.

<telerik:RadWindowManager ID="SupIntdRadWindowManager" runat="server" EnableShadow="true" DestroyOnClose="true" Behaviors="Close,Move,Resize,Pin"
        AutoSize="true" VisibleStatusbar="false" Overlay="true" ShowContentDuringLoad="false" ReloadOnShow="true"  
        Modal="true" />

 var radWin = window.radopen("Something/foo.aspx");
                    radWin.SetTitle("Foo");
                    return false;


Thanks in advanced.

Regards,
Nyi Nyi
Sam Vanhoutte
Top achievements
Rank 1
 answered on 08 Jan 2012
0 answers
59 views
I have a requirement like this:
Having Edit template as a separe user control.
From Rad grid I am specifying "Edit Form" as this Edit template USer control.
But In runtime I need to launch Edit template user control with in different "mode.". 


My Example something like this..
<RadGrid>
--
--
<MasterTableView>
<GridEditColumn>
<GridEditFormSettings>
 <uc:EditTemplate Mode="UnRead" ... ; >
<ucEditTemplate Mode="Read"

Mode here is a public property of User control..which i will use to handle different panels..

SO,In a nutshell,How to change Edit template's property before that page launches?
Please help..! Tried item_bound,Item_created events..But not getting.. :(
Krish
Top achievements
Rank 1
 asked on 08 Jan 2012
2 answers
117 views
Hi Im using amazing telerik rad grid

i just have a issue and i dont know how can i change the number of items in the combo box under the grid
the default values are set to 10 20 and 50 and i wanna change them to 100 200 and 500 How can i do this?

thank you for you support
Pouya
Top achievements
Rank 1
 answered on 08 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?