Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
812 views
I am dynamically creating a RadGrid and adding GridTemplateColumns to it. Those columns have textbox in them.
After binding datatable to the grid, after user makes changes to the textboxes and on clicking save button, I would like to access the textbox values. But I am stuck at getting hold of the textbox instance. I couldn't even get hold of GridItems!
To add more complexity, my RadGrid is in a UserControl, which is in a (multi)view.
Since my control is in view, it's Page_Init is called more than once for each action that involves this view.

Once the gridstructure is defined, it has no need to change, but I think I should be calling it on Page Init or Load every time..

I have column paging instead of row paging, so there is custom code to handle that.
I would like to get some advice on the best place to call NeedDataSource, DefineGridStructure and where to get Postback values.
I have read this article, but it has sparse information for my need. http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html
Heres my code.
protected void Page_Init(object sender, EventArgs e)
    {
        DefineGridStructure();
    }
      protected void Page_Load(object sender, EventArgs e)
      {
          if (RadGrid1 != null && RadGrid1.Items.Count > 0)
          {
              string strtxt = ((TextBox)RadGrid1.Items[1]["ProductGroup1"].Controls[0]).Text;//For starters, load one control and check it's state
          }
      }

    private void DefineGridStructure()
    {
        RadGrid1 = new RadGrid();
        RadGrid1.AutoGenerateColumns = false;
        RadGrid1.ShowHeader = true;
        RadGrid1.NeedDataSource += RadGrid1_NeedDataSource;
        foreach(GridColumn qtyColumn in BuildGridQtyColumns(PaxColumnCount))
        {
            RadGrid1.MasterTableView.Columns.Add(qtyColumn);
        }
        //Add grid to page
        phRadGrid.Controls.Add(RadGrid1);
    }
    private List<GridColumn> BuildGridQtyColumns(int count)
    {
        List<GridColumn> qtyColumns = new List<GridColumn>();
        for (int i = 1; i <= count; i++)
        {
            string qtyColumnName = string.Format("ProductGroup{0}", i);
            GridTemplateColumn qtyColumn = new GridTemplateColumn();
            qtyColumn.ItemTemplate = new GridNumberTemplate(qtyColumnName);//Creates a textbox control
            qtyColumn.UniqueName = qtyColumnName;
            qtyColumn.HeaderText = "Qty";
            qtyColumn.HeaderStyle.Width = Unit.Pixel(60);
            qtyColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
 
            qtyColumns.Add(qtyColumn);
        }
        return qtyColumns;
    }
Sridhar
Top achievements
Rank 1
 answered on 12 Mar 2012
5 answers
170 views
Hi

Can anyone tell me how to resize the inbuild RAD Grid popup without using the RAD window as a popup. I want to give a resize option once the RAD Grid popup opens for editing grid items.

Thank you in advance.

- Deepak
Pavlina
Telerik team
 answered on 11 Mar 2012
1 answer
75 views
Hi, How can i Disable RadMenu Cause Vaidation?
msigman
Top achievements
Rank 2
 answered on 10 Mar 2012
3 answers
261 views
Within a RadGrid that uses the NeedDataSource method and using paging, there is a select all column. When the Header checkbox is selected, the items on the first page are selected only. How can I select all of the records within the RadGrid.

This is the code I have in place for selecting all dataitems:
CheckBox headerCheckBox = (sender as CheckBox);
foreach (GridDataItem dataItem in this.radgridmailinglists.MasterTableView.Items)
{
    (dataItem.FindControl("chxselectrow") as CheckBox).Checked = headerCheckBox.Checked;
    dataItem.Selected = headerCheckBox.Checked;
}

Jayesh Goyani
Top achievements
Rank 2
 answered on 10 Mar 2012
3 answers
92 views
hi, I'm using RadMenu in my webapplication which shows menus and sub menus
There are Two Main Root that each has some sub menues
1. Articles
2. Videos
each item has sub menu
like this
Article > Programming
Article > Web
Article > Programming > C
Article > Programming > C#
Article > Web > ASP.NET
Article > Web > PHP

Video> Programming
Video> We
Video> Programming > C
Video> Programming > C#
Video> Web > ASP.NET
Video> Web > PHP

and so on
how can i find which of the selected items belongs to Article and Which of them belong to Video?
Behnam
Top achievements
Rank 1
 answered on 10 Mar 2012
2 answers
95 views
Hi,

I am doing grid edit and update during double click. I have got the row in edit mode while double clicking but the row is not changed to normal form after updating. The row is still in edit mode.

Thanks in advance
Ajmal
Top achievements
Rank 1
 answered on 10 Mar 2012
2 answers
69 views
Hello, I am having an issue with the RadScriptManager in Firefox. I'm trying to do a __doPostBack. And it is not working in Firefox. It works in every other browser but not FF. I noticed that the code generated from the script manager is not including the language=JavaScript param. Is this the issue. And if so how do I get the RadScriptManager to write that param.
Jon
Top achievements
Rank 1
 answered on 09 Mar 2012
1 answer
47 views
I have a graph that I'm dynamically creating. You can see it here http://www.cnppid.com/Assets/McConaughy_One-Year.jpg . How I'm building it is each day has a point. So this graph has an x range from 0 to 365. The problem is, I don't know how to add the labels so it only shows the month. Right now I have a data table with the y value, the x value, and what month it falls under. How do I make it so it shows the month label, but only once per month? Here's how I'm adding points to my graph.

For Each i As DataRow In rangeTable.Rows
            myPoint.XValue = i("Count")
            myPoint.YValue = i("Value")
            myPoint.Label.Visible = False
            mySeries.AddItem(myPoint)
Next

Web Services
Top achievements
Rank 2
 answered on 09 Mar 2012
3 answers
104 views
I have a page that I am adding a wrapper div to after the page has been completely loaded.  However, when this div is added, RadComboBoxes stop expanding or receiving input of any kind.  Upon further testing, I found that the same happens for any control that has a popup div, such as datepickers.  This is the code I'm using to add the div:

var body = GetFrameBody();
body.innerHTML = "<div id='reportwrapper' style='overflow:auto; position: relative;'>" + body.innerHTML + "</div>";

Thanks in advance for any help/insight you can offer.
Cat Cheshire
Top achievements
Rank 1
 answered on 09 Mar 2012
1 answer
62 views
Hi,

I have two controls in a page. Rad chart and Rad grid.
 I want to export both chart and grid control in same PDF or  new window.
 
Regards
Shoba.
Richard
Top achievements
Rank 1
 answered on 09 Mar 2012
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?