Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
68 views
Hey Community,

I need to lock down my grids look and feel across my entire application. I was wondering if there was a configuration I can define for the site that makes all my grids behave the same way. Sort of like using the Skin in the web.config.

Can I set any grid properties in the web.config?

For instance:
  • Skin="Transparent" - Yes, I know I can do this...
  • EnableViewState="false"
  • AllowPaging="true"
  • PageSize="18"
  • etc...

I mean it would really be nice to enable row hover, dbl-click, and other advanced features once so it guarantees a common look and feel everywhere, but could be overridden if defined in the grid markup, or programmaticly.

Thanks.

John
Tsvetina
Telerik team
 answered on 06 Sep 2011
1 answer
97 views
Hi,

I have planned to purchase ASP.Net Ajax controls with using my project. Before that i have checked sample source in 1and1 shared hosting in my account. 1and1 windows hosting has supported for .Net3.5. Sample source is working fine in my development machine. But it is not working in 1and1 windows hosting. Please give me your suggestion or sample web config file

Regards

Rameshkumar
Iana Tsolova
Telerik team
 answered on 06 Sep 2011
10 answers
237 views
Hi,
 I have a grid  (Version Q3 2009 NET35 -  Product Version:  2009.3.1314.35 - Telerik.Web.UI.dll ) with one master table and two detail tables (One inside the other one).  The details table are populated dynamically when the 
row is selected.  First time that the page runs the master table and the detail tables are populated properly.   The user selects one row 
from the master table and the data to populate the detail table is retreived from the database at that moment and the grid displays fine. 

If the user changes the search criteria for the report and hits the "Search button" the grid is refreshed (A Post back is fired). 
Master table is refreshed properly based on the new search criteria. When the detail grid is opened is still showing the data from the previous execution

The "DetailTableDataBind" event is fired.  The data used to populate the detail grid is retreived fine. The datasource for the
DetailTableView is linked to the datatable, but for any reason the  page rendered is still showing the old data.

A sample of the code is attached to make the question more understandable. 

<telerik:RadGrid ID="mkgtTotalLevels" runat="server" Skin="Outlook" OnItemDataBound="mkgtTotalLevels_ItemDataBound"
 OnNeedDataSource="mkgtTotalLevels_NeedDataSource" ondetailtabledatabind="mkgtTotalLevels_DetailTableDataBind"
 OnItemCommand="mkgtTotalLevels_ItemCommand" DataSourcePersistenceMode="NoPersistence"
 AllowPaging="True" AllowSorting="true" PageSize="20" HeaderStyle-Font-Bold="true"
 Width="100%" AutoGenerateColumns="true">
 
 <MasterTableView Name="Level1" DataKeyNames="MarketingSourceID" CommandItemDisplay="Top">
 
  <DetailTables>
   <telerik:GridTableView Name="Level2" DataKeyNames="MarketingSourceSubID" CommandItemDisplay="Top" HierarchyLoadMode="ServerOnDemand"
                AutoGenerateColumns="true"  Width="100%" BackColor="#EFEFFB" >

    <DetailTables>
     <telerik:GridTableView Name="Level3" DataKeyNames="" CommandItemDisplay="Top" HierarchyLoadMode="ServerOnDemand"
      AutoGenerateColumns="true"  Width="100%" BackColor="#FFFFCC" >     
     </telerik:GridTableView>                                                       
                </DetailTables>
                                                   
            </telerik:GridTableView>
  </DetailTables>                                           
 </MasterTableView>      
 
 
 ==============================================================================================
 
 
protected void mkgtTotalLevels_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
 BindDataGrid();
}

private void BindDataGrid()
{                       
 SetRangeDates();

 SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TargetInfoNetConnectionString"].ConnectionString);

 try
 {
  // Get a Pivot table with the Marketing Level 1 - Total of Providers
  string str = "dbo.spPivot_MkgtLevel1_Totals";
  SqlCommand cmd = new SqlCommand(str, con);
  cmd.CommandType = CommandType.StoredProcedure;

  cmd.Parameters.Add("@DateFrom", SqlDbType.Date);
  cmd.Parameters["@DateFrom"].Value = StartDate;

  cmd.Parameters.Add("@DateTo", SqlDbType.Date);
  cmd.Parameters["@DateTo"].Value = EndDate;

  SqlDataAdapter da = new SqlDataAdapter(cmd);
  DataTable dt = new DataTable();
  da.Fill(dt);
  
  mkgtTotalLevels.DataSource = dt;               
 }

 finally
 {
  con.Close();
 }
}

protected void mkgtTotalLevels_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
{
 GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;

 //**** Level 2 ****
 if (e.DetailTableView.Name == "Level2")
 {
  DataTable dt2 = new DataTable();
  Int32 Level1 = 0;
  Int32.TryParse(dataItem.GetDataKeyValue("MarketingSourceID").ToString(), out Level1);
   
  dt2 = GetLevel2Data(Level1);
      
  e.DetailTableView.DataSource = dt2;               
 }

 //**** Level 3 ****
 if (e.DetailTableView.Name == "Level3")
 {
  DataTable dt3 = new DataTable();
  Int32 Level2 = 0;
  Int32.TryParse(dataItem.GetDataKeyValue("MarketingSourceSubID").ToString(), out Level2);
  
  dt3 = GetLevel3Data(Level2);
  e.DetailTableView.DataSource = dt3;
 }
}

private DataTable GetLevel2Data(int Level1)
{
 DataTable dt = new DataTable();

 SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TargetInfoNetConnectionString"].ConnectionString);

 try
 {
  SetRangeDates();
  // Get a Pivot table with the Marketing Level 2 - Total of Providers
  string str = "dbo.spPivot_MkgtLevel2_Totals";
  SqlCommand cmd = new SqlCommand(str, con);
  cmd.CommandType = CommandType.StoredProcedure;

  cmd.Parameters.Add("@DateFrom", SqlDbType.Date);
  cmd.Parameters["@DateFrom"].Value = StartDate;

  cmd.Parameters.Add("@DateTo", SqlDbType.Date);
  cmd.Parameters["@DateTo"].Value = EndDate;

  cmd.Parameters.Add("@MarketingSourceID", SqlDbType.Int);
  cmd.Parameters["@MarketingSourceID"].Value = Level1;

  SqlDataAdapter da = new SqlDataAdapter(cmd);
  
  da.Fill(dt);

  return dt;
 }

 finally
 {
  con.Close();
 }
}

private DataTable GetLevel3Data(int Level2)
{
 DataTable dt = new DataTable();
 SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TargetInfoNetConnectionString"].ConnectionString);

 try
 {
  SetRangeDates();

  // Get a Pivot table with the Marketing Level 3 - Total of Providers
  string str = "dbo.spPivot_MkgtLevel3_Totals";
  SqlCommand cmd = new SqlCommand(str, con);
  cmd.CommandType = CommandType.StoredProcedure;

  cmd.Parameters.Add("@DateFrom", SqlDbType.Date);
  cmd.Parameters["@DateFrom"].Value = StartDate;

  cmd.Parameters.Add("@DateTo", SqlDbType.Date);
  cmd.Parameters["@DateTo"].Value = EndDate;

  cmd.Parameters.Add("@MarketingSourceSubID", SqlDbType.Int);
  cmd.Parameters["@MarketingSourceSubID"].Value = Level2;

  SqlDataAdapter da = new SqlDataAdapter(cmd);

  da.Fill(dt);

  return dt;
 }

 finally
 {
  con.Close();
 }
}

private void SetRangeDates()
{
 DateTime tmpDate;
 int intYear = 0;
 int intMonth = 0;
 int intDay = 0;

 // **** Start Date ****
 intYear = int.Parse(ddlFromYear.SelectedValue.ToString());
 intMonth = int.Parse(ddlFromMonth.SelectedValue.ToString());
 intDay = 1;

 tmpDate = new DateTime(intYear, intMonth, intDay);
 StartDate = tmpDate;

 // **** End Date ****
 intYear = int.Parse(ddlToYear.SelectedValue.ToString());
 intMonth = int.Parse(ddlToMonth.SelectedValue.ToString());
 tmpDate = new DateTime(intYear, intMonth, 1);
 tmpDate = tmpDate.AddMonths(1);
 tmpDate = tmpDate.AddDays(-1);
 intDay = tmpDate.Day;
 tmpDate = new DateTime(intYear, intMonth, intDay);
 EndDate = tmpDate;
}

 




 

 

Dheeraj
Top achievements
Rank 1
 answered on 06 Sep 2011
2 answers
129 views
In my sharepoint application, I am using RadEditor (RadEditorSharePoint.dll V5.3.2.0) for displaying and editing the content of product. Till now I have used Rad Editor for single product only with the below code.

for setting data:
RadEditor.content = strProductContent

for getting data:
strProductContent = RadEditor.content

In my new requirement, i need to display the content of all the products at once and user can edit all the products content at once. How to display all the data with product name and product content in a table style like

Product1 Name
Product1 Content.

Product2 Name
Product2 Content.

Product3 Name
Product3 Content.


While reading the data from RadEditor, how to segregate the data. Can we use any html controls in the content area to achieve this?

Thanks in Advance.
satish
Top achievements
Rank 1
 answered on 06 Sep 2011
5 answers
102 views
Hi

I am building a RadGrid dynamically, thus:

protected void Page_Init(object source, System.EventArgs e)
        {
            this.phRadGrid1.Controls.Add(DefineGridStructure());
            RadAjaxManager manager = new RadAjaxManager();
            manager.ID = "RadAjaxManager1";
            manager.DefaultLoadingPanelID = "RadAjaxLoadingPanel1";
            this.Page.Form.Controls.Add(manager);
        }

and then in the Page_Load event I am setting the Ajax to the Grid

// ajaxify Grid
            RadGrid1 = (RadGrid)phRadGrid1.FindControl("RadGrid1");
            RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
            manager.AjaxSettings.AddAjaxSetting(RadGrid1, RadGrid1);

This works 100%.

The grid is made up of Parent and Child Rows - I want to DISABLE the Ajax when I am working in the Child Rows.
I think I need to be more specific in defining the AjaxSettings above ie in this line:
manager.AjaxSettings.AddAjaxSetting(RadGrid1, RadGrid1);

I am not sure how to begin to do this. My first thought is to catch the Ajax Begin and End Response events in the Javascript and only pass them on when active in the parent rows of the grid, but I am not sure if this will work?

Some pointers would be much appreciated.

Regards
Simon
Simon
Top achievements
Rank 1
 answered on 06 Sep 2011
1 answer
70 views
I'm having a problem implementing Load On Demand for TabStrip. I've implemented everything on the demo page but when I run my code I'm getting an error in the code behind on the function:

protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
{
    AddPageView(e.Tab.Text);
    e.Tab.PageView.Selected = true;
}

The error is "Multiple controls with the same ID 'Subdomains' were found. FindControl requires that controls have unique IDs.". Basically when the page loads first and you click on the tabs everything is great and working but if you re-click a tab that you already have clicked then you get this error. It's almost like the JS code below isn't running and yes my RadTabStrip is calling OnClientTabSelecting="onTabSelecting".

<script type="text/javascript">
function onTabSelecting(sender, args)
{
    if (args.get_tab().get_pageViewID())
    {
        args.get_tab().set_postBack(false);
    }
}
</script>

Any help would be greatly appreciated. Thanks!
Dimitar Terziev
Telerik team
 answered on 06 Sep 2011
4 answers
166 views
Hi,
  I hava create a RadGrid to Bind something using DetailsTable , set the AutoGenerateColumns as true .
 It display well at first time , but when I Rebind the datasource(the columns is not as same as the first) , The Columns of DetailsTable don't change  .

The Code like below :

1.aspx:
    
    <div> 
        <asp:DropDownList ID="DropDownList1" runat="server" onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true"
        <asp:ListItem Value="1" Text="MoreParams"></asp:ListItem> 
        <asp:ListItem Value="0" Text="LessParams" ></asp:ListItem> 
        </asp:DropDownList> 
        <rad:RadGrid ID="rgBug"  runat="server" AutoGenerateColumns="true" ondetailtabledatabind="rgBug_DetailTableDataBind" onneeddatasource="rgBug_NeedDataSource" > 
           <ClientSettings AllowExpandCollapse="true"></ClientSettings> 
            <MasterTableView  HierarchyDefaultExpanded="true" HierarchyLoadMode="Client"
                <DetailTables> 
                <rad:GridTableView  runat="server"></rad:GridTableView> 
                </DetailTables> 
            </MasterTableView> 
        </rad:RadGrid> 
    </div> 


2.cs:
    
   protected DataTable LessDataTable() 
        { 
            DataTable dt = new DataTable(); 
            DataColumn dc = new DataColumn(); 
            dc.Caption = "ID"
            dc.ColumnName = "ID"
            DataColumn dc2 = new DataColumn(); 
            dc2.Caption = "Name"
            dc2.ColumnName = "Name"
            dt.Columns.Add(dc); 
            dt.Columns.Add(dc2); 
 
            DataRow row = dt.NewRow(); 
            row[0] = 1; 
            row[1] = "Bruce Lee"; 
 
            dt.Rows.Add(row); 
            return dt; 
        } 
 
        protected DataTable MoreDataTable() 
        { 
            DataTable dt = new DataTable(); 
            DataColumn dc = new DataColumn(); 
            dc.Caption = "ID"
            dc.ColumnName = "ID"
            DataColumn dc2 = new DataColumn(); 
            dc2.Caption = "Name"
            dc2.ColumnName = "Name"
            DataColumn dc3new DataColumn(); 
            dc3.Caption = "Age"
            dc3.ColumnName = "Age"
            dt.Columns.Add(dc); 
            dt.Columns.Add(dc2); 
            dt.Columns.Add(dc3); 
 
            DataRow row = dt.NewRow(); 
            row[0] = 1; 
            row[1] = "Hyden Panetieer"; 
            row[2] = 23; 
 
            dt.Rows.Add(row); 
            return dt; 
        } 
 
        protected void rgBug_NeedDataSource(object source, Telerik.WebControls.GridNeedDataSourceEventArgs e) 
        { 
            if (DropDownList1.SelectedIndex != 0) 
                rgBug.DataSource = LessDataTable(); 
            else 
                rgBug.DataSource = MoreDataTable(); 
        } 
 
        protected void rgBug_DetailTableDataBind(object source, Telerik.WebControls.GridDetailTableDataBindEventArgs e) 
        { 
            if (DropDownList1.SelectedIndex != 0) 
                 e.DetailTableView.DataSource = LessDataTable(); 
            else 
                 e.DetailTableView.DataSource = MoreDataTable(); 
        } 
 
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 
        { 
            rgBug.Rebind(); 
        } 


========

The code is easy , but it cant do best for me
 





Dheeraj
Top achievements
Rank 1
 answered on 06 Sep 2011
5 answers
497 views
Hi all,

why does onupdatecommand and onitemupdated not fierd ?? here is the codes : 

aspx :
        <telerik:RadGrid ID="RadGrid1" runat="server" OnItemUpdated="companyGridUpdated" 
            AllowPaging="True" AllowSorting="True" OnUpdateCommand="companyGridUpdate" 
            AutoGenerateColumns="False" GridLines="None" Skin="Vista" AllowAutomaticUpdates="True">
                <MasterTableView ShowFooter="True" DataKeyNames="ID">
                    <Columns>
                        <telerik:GridBoundColumn UniqueName="ID" DataField="ID" Visible="False">
                        </telerik:GridBoundColumn>
                         <telerik:GridBoundColumn UniqueName="CompanyID" DataField="CompanyID" Visible="False">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Name" DataField="Name" UniqueName="Name">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Notes" DataField="Notes" UniqueName="Notes">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Status" DataField="Status" UniqueName="Status">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="IP Address" DataField="IPAddress" UniqueName="IPAddress">
                        </telerik:GridBoundColumn>
                        <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
                        </telerik:GridEditCommandColumn>
                    </Columns>
                    <EditFormSettings EditFormType="Template">
                        <EditColumn UniqueName="EditCommandColumn1">
                        </EditColumn>
                        <FormTemplate>
                            <table id="Table1" style="padding:5px;">
                                <tr valign="top">
                                    <td colspan="2">
                                        <br />
                                        <b>Edit details for 
                                            <asp:Label Id="Label1" Text='<%#Bind("Name") %>' runat="server"></asp:Label>
                                        </b><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td>
                                        Node Server Name : 
                                    </td>
                                    <td>
                                        <telerik:RadTextBox runat="server" Text='<%#Bind("Name") %>'
                                        ID="RadEditNodeName" DataTextField="Name"></telerik:RadTextBox>
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td>
                                        Node Server Details : 
                                    </td>
                                    <td>
                                        <telerik:RadTextBox runat="server" Text='<%#Bind("Notes") %>' 
                                         ID="RadEditNodeNotes" DataTextField="Notes"></telerik:RadTextBox>
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td colspan="2">
                                      <asp:Button ID="btnUpdate" Text="Update" runat="server" CausesValidation="False" CommandName="Update">
                                   </asp:Button>
                                   <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                                    </td>
                                </tr>
                            </table>
                        </FormTemplate>
                    </EditFormSettings>
                </MasterTableView>
        </telerik:RadGrid>
<asp:HiddenField ID="GridEditableValue" runat="server" />
CS : 
        protected void Panel_Load(object sender, System.EventArgs e)
        {
            BTServerNode[] nodes = (BTServerNode[])ViewState["NODES"];

            if (nodes == null)
            {
                BTServerNodeFactory nodeFactory = new BTServerNodeFactory(ConnectionString);
                nodes = nodeFactory.GetNodesByCompany(AdminUser.CompanyID);
                ViewState["NODES"] = nodes;
            }

            RadGrid1.DataSource = nodes;
            RadGrid1.DataBind();
        }

        protected void companyGridUpdate(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName.Equals("Update"))
            {
                RadTextBox nameBox = (RadTextBox)e.Item.FindControl("RadEditNodeName");
                RadTextBox notesBox = (RadTextBox)e.Item.FindControl("RadEditNodeNotes");
                GridEditableValue.Value = nameBox.Text + ";" + notesBox.Text;
            }
        }

        protected void companyGridUpdated(object sender, Telerik.Web.UI.GridUpdatedEventArgs e)
        {
//TODO: save the values from GridEditableValue to db.
        }
Jai
Top achievements
Rank 1
 answered on 06 Sep 2011
1 answer
28 views
I have the basic scheduler working fine, shows grouped resources, but want to scheduler to show/display one group at a time, how I might be able to control which resource I 'filter' on.
Plamen
Telerik team
 answered on 06 Sep 2011
2 answers
55 views
We're using the asp.net radscheduler (day and weekview). It's populated through a webservice.

1) Is it possible to make certain cells have another background color? As an example, make 08:00-10:00, 10:30-12:00, 13:00-15:00, 15:30-17:00 (mon - fri) light green while the rest of the cells are light red?

2) Can you format the contents of the appointment in a better way? It seems now both the appointment content and the tooltip uses the Subject property. If you use html-tags in the Subject the tooltip will look bad (showing the tags).

3) The date in the headers gets written in english (like "monday"), we would like this to be swedish. We tried setting the Culture property to "sv-SE", but didn't seem to have an effect. Calling System.DateTime.Now.ToString() on the asp.net webpage prints in swedish so we don't think it's a server setting/issue.

Thanks
Plamen
Telerik team
 answered on 06 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?