Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
133 views

I'm creating my first Visual Web Part project with Visual Studio 2010 (C#). The purpose of this simple project is to become better aquainted with the RadGrid control. There are basically two parts to it:

1. Add RadGrid control and bind to datasource using C#. The RadGrid has an edit and delete column.

2. Add a RadTextBox control to display the captured content of a specific cell when I click on the update option when editing the record.

Part 1 is pretty straightforward and seems to work fine. Here is the code that I run upon page load:

private void bindGrid(RadGrid grid)
    {
        string qry = "SELECT Recipient, Email FROM Table1";
        SqlConnection conn = new SqlConnection(connection string);
        SqlCommand cmd = new SqlCommand(qry, conn);
        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
        DataTable recipients = new DataTable();
            try
            {
                conn.Open();
                adapter.Fill(recipients);
            }
            catch (Exception ex)
            {
            }
            finally
            {
               grid.DataSource = recipients;
               grid.DataBind();
               conn.Close();
            }
    }

The problem is with part 2. When I click on edit then update I want to capture the value in that row for the column labeled "Recipient".
I try to do this with the following code:

protected void Update_Command(object sender, GridCommandEventArgs e)
  {
       
      if (e.Item is GridDataItem)
      {
          GridDataItem dataItem = e.Item as GridDataItem;
          RadTextBox1.Text = dataItem["recipient"].Text.ToString(); 
      }
      else if (e.Item is GridEditFormItem)
      {
      }
  }

Instead of getting the persons name displayed in the cell, all I get is "&nbsp"; I've tried this several different ways, even using
the NeedDataSource method. The result is always the same.

Out of curiousity I counted the columns in the RadGrid immediately after binding with RadGrid1.columns.count and get 0. So the RadGrid displays the data from the datasource properly on page load, but I can't seem to access any of that data.

I can't figure this out and any guidance would be greatly appreciated.


Tsvetoslav
Telerik team
 answered on 25 Oct 2010
1 answer
157 views
My issue is very similar to the case described in: http://www.telerik.com/community/forums/aspnet-ajax/combobox/2010-1-415-radcombobox-automatic-load-on-demand-broken-after-any-postback.aspx

I have a RadComboBox with LoadOnDemand=true and have implemented the ItemsRequested method in my codebehind. I'm using AutoPostBack=true.

My problem is that after selecting an item (and the postback completes), I see this behaviour:

1) I clicked the arrow to open the combobox
2) The ItemsRequested event fires on the server
3) The combobox opens and shows only the selected item
4) I click elsewhere on the screen to blur the combobox
5) I open the combobox again
6) All the list items appear in the combobox but ItemsRequested wasn't called again.


I'm puzzled why this is happening. If I am trying to open the combobox (after a postback) and this triggers the ItemsRequested event, why do the items not appear in my browser until I re-open the combobox?

Is this a bug in RadComboBox, or is there some client JS I could use to get the items re-populating on a subsequent click? Is there a common use case for RadComboBox using both LoadOnDemand and AutoPostBack, or am I trying to use it in an unintended way?
Simon
Telerik team
 answered on 25 Oct 2010
1 answer
145 views
Hi,

I'm dealing with a scenario where I want to construct a grid with multiple datasets. I.e. One grid control with multiple tables within it (each table with a different datasource).

I return the XML data from Sql Server and load the XML into multiple datasets using the DataSet's ReadXml() function.

Each DataSet in turn gets added to a dictionary with a GUID to reference it back when I need to make changes to a specific dataset.

I was looking at using the GridTableView class but I'm not sure if this will fulfill my needs.

For a quick experiment I tried doing the following:

foreach (KeyValuePair<Guid, DataSet> ds in dataSetCollection)
{
GridTableView gtv = new GridTableView(RadGrid1);
gtv.DataSource = ds.Value; //ds.Value is a DataSet object
gtv.DataBind();
RadGrid1.MasterTableView.DetailTables.Add(gtv);
}

The above doesn't seem to do anything, just a blank grid.

What am I missing here or is there any alternative route I can take to achieve the same?

Thanks for your help.
Tsvetina
Telerik team
 answered on 25 Oct 2010
1 answer
119 views
Hello,
i have a problem that i could not solve by simple adding "position:relative" to the scrollable parent.

I'm using the radSlider inside a grid's FilterTemplate, just like you use in the GRid -> FilterTempalte example on your Demos page.

The difference is that i'm using the :

<Scrolling SaveScrollPosition="true" AllowScroll="true" UseStaticHeaders="true" />

the problem is, of course, with the slider not moving along with the scroll bars of the grid...and actually appear outside the grid fix width and adding horizonal scroll bar to my page.

I added the css class:

 

 

.rgDataDiv { position: relative !important; }

as i noticed the parent scrollable control is a div with the class i mentioned before...and still the same problem within IE7.

I attach the grid control definition :

<telerik:RadGrid ID="gridCases" runat="server" AllowPaging="true" AllowCustomPaging="false" PageSize="30" Width="894px" EnableAjaxSkinRendering="true" GridLines="None" Height="455" AllowSorting="true" style="border-left-style:none !important; border-right-style:none !important; position:relative;">

I attach also the FilterTempalte part of the slider:

<div style="float:left; padding: 5px 7px 0 0;">$0</div>
<div style="float:left;">
    <telerik:RadSlider runat="server" ID="RadSlider1" IsSelectionRangeEnabled="true"
    MinimumValue="0" MaximumValue="1010" SmallChange="5" ShowDecreaseHandle="false"
    ShowIncreaseHandle="false" Width="120px" SelectionStart='<%# startSlider %>'
    SelectionEnd='<%# endSlider %>' OnClientValueChanged="ClientValueChange" OnClientSlideStart="ClientSlideStart"
    OnClientSlideEnd="FreightRangeChanged" />
</div>
<div style="float: left; padding: 5px 0 0 7px">$1000</div>
<div style="clear: both">
    <asp:Literal ID="Literal1" runat="server" Text='<%# "Showing: $" & startSlider & " to $" & endSlider %>' />
</div>

Thank you in advance
Tsvetie
Telerik team
 answered on 25 Oct 2010
2 answers
136 views
One of the fields that I get back from the database has a max length of 200 characters.  I want to only show about 80 characters when in grid view, with an elipsis at the end of the data so that the user knows there is more text.  All the text would be shown when in edit mode.  What would be the best way to accomplish this?  Thanks.
Kathy
Top achievements
Rank 1
 answered on 25 Oct 2010
1 answer
70 views
I am running IE8 and 2010 Q2 of the telerik controls.  I am using a custom skin that is setting properties on the rgHeader element.  According to IE8 developer tools, some properties in my custom skin are being overriden by settings from webresource.axd.

The final style applied to my grid header is .radGrid .rgHeader when it should be .radGrid_SharedList .rgHeader.  Why would this other sytel get applied to my grid instead of just the style from the skin?
Dimo
Telerik team
 answered on 25 Oct 2010
1 answer
82 views
After programamtically changing the expanded GridItem setting the property RadGridItem.Expanded to true, the RadGrid_ItemCommand event is not fired. It should be automatically fired since it should behave the same as expanding the item with a mouse click.
Princy
Top achievements
Rank 2
 answered on 25 Oct 2010
4 answers
192 views
hi

I've run into another wee issue, I have a text box (bog standard one) that when I type in part or all of a company name populates a dropdown commbobox (with checkboxes), that all works fine what  need to do is when they select a company from the new list I want it to update another list, but I dont seem to have anyway of capturing the fact that the text has changed in the combobox. I've tried all manner of ways, behind and in the page but I cant get the  OnTextChanged="CaseType_TextChanged" in the same way it works for the text box. Ive tried  ddlCaseList.TextChanged +=new EventHandler(ddlCaseList_TextChanged); but to no avail. I just need to know where to put the the call which captures the event that will fire the event handler!


any thoughts ?

thanks
Pavlina
Telerik team
 answered on 25 Oct 2010
2 answers
150 views
Hi guys,

I am using your Editor and I have 2 issues :

1- On Deployment I get the following error :

Could not find a part of the path 'c:\windows\system32\inetsrv\~\App_Code\ToolsFile.xml'.

I have set ToolsFile="~/App_Code/ToolsFile.xml" in Editor Control. the xml file is located inside the App_Code folder.

2- I can't find a way to able rtl writing in the editor. I have a multilingual website and this is a show stopper
.

Any suggestions? Thanks.




Joseph
Top achievements
Rank 1
 answered on 25 Oct 2010
1 answer
124 views
Can I reference the same ColumnEditor from two different column's ColumnEditorID property in the same RadGrid? It would appear I cannot. If not, I suppose I do not see the advantage that declarative column editors have over TemplateColumns.
Tsvetina
Telerik team
 answered on 25 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?