Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
227 views
Hi,

I am binding radgrid from code behind using a dataset.

Grid1.DataSource= MyDataSet;
Grid1.DataBind();

Now, when i update/delete or inset a new record, i want to retrieve the updated DataSet back. What's the best way to do it?

I want something

Grid1_InsertCommand(....)
{
   DataSet MyNewDS= Grid1.GetUpdatedDataSet();
}

I want to do a batch update of DataSet in the database, not on every insert command.

Thanks.
Shinu
Top achievements
Rank 2
 answered on 05 Feb 2010
3 answers
62 views
Hello,
I am using the error handler example linked here:

http://www.telerik.com/help/aspnet/grid/grderrorhandling.html


The code runs fine, but it does not return a vaule for the field, it returns &nbsp rather than the key value. Correct values are displayed in the grid.

Any advice would be appreciated.




Princy
Top achievements
Rank 2
 answered on 05 Feb 2010
1 answer
355 views
What is the best practice you would suggest when filtering a fairly large data set (~400K records) in the grid? This is my current scenario:

1. I have a grid, a couple of search fields, and a search button. Standard paging is enabled in the grid.
2. The grid has a NeedDataSource event handler that runs a query against my database and then populates the grid with the results from the query. This query selects all records from the appropriate database tables. The DataSource property of the grid is set to this query.
3. The Click event handler of the search button checks if any of the search fields has text in it. If so, the FilterExpression of the grid is built with the proper criteria. If no search fields have any text, then the FilterExpression will remain empty and all records are returned. At the end, the Click event handler calls Rebind() on the grid, which in turn will call the NeedDataSource event handler.
4. The Page Index Changed event handler updates the current page index and calls Rebind() on the grid.

The filtering and paging work but it's rather slow (~20 seconds). Is this the correct approach for this problem? I'm worried that I'm getting all database records every single time and my application will be used in a low-bandwidth scenario. Or would it be better to change my query in the NeedDataSource event handler directly so that the grid DataSource property is only set to what is actually specified in the search criteria rather than use the FilterExpression?
Princy
Top achievements
Rank 2
 answered on 05 Feb 2010
1 answer
67 views
Hi,
    How do I add child rows to a hierachy grid, without allowing inserts to the Parent table. I have put Allowautotmaticinserts = "true"
in the properties and this Just seems to allow me to add a top level row, there is now "Add new Row" add the child level.

The html for the grid is as below
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"  AllowMultiRowEdit="true" AllowPaging="True" AllowAutomaticUpdates="True"
    AllowSorting="True" GridLines="None" DataSourceID="sds_requests_by_status" AutoGenerateColumns="False"  AllowAutomaticInserts="true"
        AutoGenerateHierarchy="True" OnNeedDataSource="RadGrid1_NeedDataSource" Skin="WebBlue">
    <MasterTableView DataKeyNames="id"   DataSourceID="sds_requests_by_status" EditMode="InPlace">
        <DetailTables >
                    <telerik:GridTableView DataKeyNames="id" DataSourceID="sds_products_by_request" Width="100%" runat="server">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="id" MasterKeyField="id" />
                        </ParentTableRelation>
                        <Columns>
                             <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="editcolumn">
                              <ItemStyle CssClass="MyImageButton" /> </telerik:GridEditCommandColumn>
                                  <telerik:GridBoundColumn SortExpression="id" HeaderText="id"  ReadOnly="true" HeaderButtonType="TextButton"
                                DataField="id" UniqueName="id" >
                            </telerik:GridBoundColumn>
                             <telerik:GridBoundColumn SortExpression="session_id" HeaderText="session_id"  ReadOnly="true" HeaderButtonType="TextButton"
                                DataField="session_id" UniqueName="session_id" Visible="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="product_code" HeaderText="product code" ReadOnly="true" HeaderButtonType="TextButton"
                                DataField="product_code" UniqueName="product_code">
                            </telerik:GridBoundColumn>
                              <telerik:GridBoundColumn SortExpression="description" HeaderText="description" ReadOnly="true" HeaderButtonType="TextButton"
                                DataField="description" UniqueName="description">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="supplier_code" HeaderText="Supplier code" ReadOnly="true" HeaderButtonType="TextButton"
                                DataField="supplier_code" UniqueName="supplier_code">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="price" HeaderText="Price" ReadOnly="true" HeaderButtonType="TextButton"
                                DataField="price" UniqueName="price">
                            </telerik:GridBoundColumn>
                              <telerik:GridBoundColumn SortExpression="currency_code" HeaderText="Currency code" ReadOnly="true" HeaderButtonType="TextButton"
                                DataField="currency_code" UniqueName="currency_code">
                            </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="quantity" HeaderText="Unit quantity" ColumnEditorID="edit_quantity"  HeaderButtonType="TextButton"
                                DataField="quantity" UniqueName="quantity">
                            </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="" HeaderText="Product_price_id" ColumnEditorID="edit_product_price_id"  HeaderButtonType="TextButton"
                                DataField="Product_Price_Id" UniqueName="Product_Price_Id">
                            </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="" HeaderText="user_id"  ReadOnly="true"  HeaderButtonType="TextButton"
                                DataField="user_id" UniqueName="user_id">
                            </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="" HeaderText="user_identity"  ReadOnly="true"  HeaderButtonType="TextButton"
                                DataField="user_identity" UniqueName="user_identity">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </telerik:GridTableView>
          </DetailTables>            
        <Columns>
              <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="editcolumn">
                    <ItemStyle CssClass="MyImageButton" />
                </telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn DataField="id" DataType="System.Int32" HeaderText="Request No." ReadOnly="True"
                SortExpression="id" UniqueName="id"  >
            </telerik:GridBoundColumn>
            
            <telerik:GridDropDownColumn FilterControlWidth="160px"   DataField="request_status" DataSourceID="sds_request_status"
            HeaderText="Request Status" ListTextField="Request_status" ListValueField="request_status"
            UniqueName="request_status" ColumnEditorID="GridDropDownColumnEditor1">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="RadCbo_Request_status" DataSourceID="sds_request_status" DataTextField="request_status"
                                DataValueField="request_status" Height="200px" AppendDataBoundItems="true"
                                SelectedValue='<%#((GridItem)Container).OwnerTableView.GetColumn("request_status").CurrentFilterValue %>'

                                runat="server" OnClientSelectedIndexChanged="RequestStatusChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                                
                            </telerik:RadComboBox>
                            <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                                <script type="text/javascript">
                                    function RequestStatusChanged(sender, args) {
                                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("request_status", args.get_item().get_value(), "EqualTo");
                                    }
                                </script>
                            </telerik:RadScriptBlock>
                        
</FilterTemplate>
             <HeaderStyle Width="160px" />
        </telerik:GridDropDownColumn>
            
         <%--   
              <telerik:GridBoundColumn DataField="request_status" HeaderText="Status" SortExpression="request_status"
                UniqueName="request_status">
            </telerik:GridBoundColumn>--%>
              <telerik:GridBoundColumn DataField="request_date" DataType="System.DateTime" ReadOnly="true" HeaderText="Request Date" SortExpression="request_date"
                UniqueName="request_date">
            </telerik:GridBoundColumn>
               <telerik:GridBoundColumn DataField="price" DataType="System.Decimal" ReadOnly="true"  HeaderText="Value"
                SortExpression="price" UniqueName="price">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="first_name"  HeaderText="Submitter First Name" ReadOnly="true"
                SortExpression="first_name" UniqueName="first_name">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="last_name"  HeaderText="Submitter Last Name" ReadOnly="true"
                SortExpression="last_name" UniqueName="last_name">
            </telerik:GridBoundColumn>
        </Columns>
         <ExpandCollapseColumn Visible="True">
            </ExpandCollapseColumn>
    </MasterTableView>
    <ClientSettings>
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
</telerik:RadGrid>

Thanks
Robert Smith
Tsvetoslav
Telerik team
 answered on 05 Feb 2010
1 answer
127 views
Hi Telerik,
I want to reset the filter in columns and i did like this, as show in some other posts. However when the grid rebind, it still show the filtered records, even though the collection attached to grid has full records. What am i doing wrong?
Thank you

protected void btnReset_Click(object sender, EventArgs e) 
    { 
        foreach (GridColumn column in grdContacts.MasterTableView.Columns) 
        { 
            column.CurrentFilterValue = string.Empty; 
        } 
        grdContacts.Rebind(); 
        
    } 

Tsvetoslav
Telerik team
 answered on 05 Feb 2010
1 answer
181 views
hello
do you know how can create a EForm Builder with telerik object and thet wint Ajax?

thanks A lot
Sebastian
Telerik team
 answered on 05 Feb 2010
9 answers
350 views
I have finally converted a page from the old Telerik.Web.Control ajax stuff to the new Telerik.Web.UI version. When I call AddAjaxSetting, I get a NullReferenceException. Here is my code:

ajax_manager.AjaxSettings.AddAjaxSetting(link_type_list, category_list, loading_panel);

In the debugger, I can see that ajax_manager.GetCurrent() returns null, which I believe is causing the error (the ajax manager variable itself, and my controls are all non-null). This code runs in the page_load event of the ascx control which contains the ajax manager and my controls.

I am using the latest release - 2009 Q3 SP2.
Pavlina
Telerik team
 answered on 05 Feb 2010
3 answers
615 views

Hi All,

I have a custom web part which includes RAD Chart control.
This web part is used in WSS 3.0.

SharePoint List data is displayed in RAD Chart.

I added series to RAD Chart.

Series max Y value is 1.5E+28 and min Y value is 1.5E+28

 

double seriesMaxYVal = radChartObj.Series.GetMaxYValue();   
 
double seriesMinYVal = radChartObj.Series.GetMinYValue();   
 

 

 

 

I set Y-axis isLogarithmic property as true.
  

 

 

radChartObj.PlotArea.YAxis.IsLogarithmic = true;    
 

  

 

 

 

But RenderContents function is throwing exception.

Inner Exception: 
{"Value was either too large or too small for a Decimal."}

Stack Trace: 
"   at System.Decimal..ctor(Double value)\r\n   at Telerik.Charting.ChartYAxis.Initialize(Double min, Double max)\r\n   at Telerik.Charting.ChartYAxis.InitializeItems()\r\n   at Telerik.Charting.ChartPlotArea.InitializeAxes()\r\n   at Telerik.Charting.RenderEngine.InitializeChartElements()\r\n   at Telerik.Charting.Chart.GetImage(Int32 width, Int32 height)"


Please let me know if there is any limitaion of series item value in RADChart.

Please suggest a solution.

Thanking you in anticipation.

Regards,
LJ

 

Ves
Telerik team
 answered on 05 Feb 2010
2 answers
107 views
Ok so in the Contents holders of my master pages I will be displaying grids.  I want to add an RADAjaxManager to prevent postbacks.

When I add the control (RADAjaxManager) to my Contents page and then select Configure Ajax Manager on the smart tag I do not see my grid listed.  I have a grid and a SqlDataSource item but I don't see them on there (screenshot attached).  So then I thought I needed to add it to my Master Page Main Content spot but then I wouldn't be able to associate the AjaxManager to the different grids that display in the Main Content spot within the Master page.

So my question - Am I not able to use the AjaxManager within a contents page?  If not what can I do.  If I can, what am I doing wrong.

Thanks,
Nathan
Tsvetoslav
Telerik team
 answered on 05 Feb 2010
13 answers
267 views
Here's what I am trying to do. A application for certain users to update data in the Database.

How it works:
On the first page a list of tables is displayed in a radgrid. Users can click on the table they wish to edit and will send them to the next page. Where they are able to edit data from the chosen table. This again with the radgrid.

This application works fine and only consist of 2 aspx pages. The name of the table is sent from page 1 to page 2 where it changes the connectionstring to display the data of the chosen table. Radgrid auto-generate columns is on and does the job nicely.

However..

Here is the problem.
Radgrid displays al fields of the database in edit-mode as text fields. However there are some columns with foreign keys which I wish to display a combobox/radcombo for.

Question:
How can I, preferable let Radgrid generate those columns automatically? Or is there no other way than check all data types and relations during runtime and programmaticly build up the columns ?

Thank you.

Dario Zanelli
Top achievements
Rank 1
 answered on 05 Feb 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?