Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
177 views
Hi..
How do I modify the following javascript code to call the RadWindow vs. the Confirm() method.


sSave = window.confirm(

"You have some changes that have not been saved. Click OK to SAVE now or CANCEL to continue without saving.");

 

 

Tervel
Telerik team
 answered on 26 Nov 2008
1 answer
93 views
Hi, i have a aspx  application when the detail table in edit mode then the master table will change back to normal mode.

how can i keep both master and detail table in edit mode?

thks!!!!
From CH
Vlad
Telerik team
 answered on 26 Nov 2008
4 answers
285 views
 I have a master page which has an instance of the RadAjaxManager on it (Named RadAjax). I have a content page which has options to open a window (RadWindow). When you click on a button on this open window it injects some JavaScript that is supposed to force a refresh of the calling page, then close itself. I'm in the process of trying to update to the AJAX version of the controls and things aren't quite working.

In my first content page, I have this JavaScript function:

var ajaxManager = $find("<%= Telerik.Web.UI.RadAjaxManager.GetCurrent(Page).ClientID %>"); 
ajaxManager.ajaxRequest("Rebind"); 

I know this function is getting called correctly from my "pop in" form. However, ajaxManager is null so the rebind never occurs. I looked at the generated JS in the page and the markup is getting translated to this, which looks correct. What am I missing?

var ajaxManager = $find("ctl00_RadAjax"); 
 




Maria Ilieva
Telerik team
 answered on 26 Nov 2008
1 answer
62 views
Hi,

I have a Problem with setting a link via Javascript.

I set a link like
"<A> class=LINK HREF="##LINKSPACER##">TEST</A>" 

Directly after setting the content the Link looks like this
"<A class=LINK href="http://localhost/okkult/olymp/PageEdit.aspx?page_id=7727##LINKSPACER##" HREF="##LINKSPACER##">TEST</A>" 

The Code looks like

 

var text = "<A class=LINK HREF="##LINKSPACER##">TEST</A>";  
alert(text);  
editor.set_html(text);  
alert(editor.get_html());  
 

How can I disable this behavior?
Rumen
Telerik team
 answered on 26 Nov 2008
1 answer
115 views
i have a grid in rad window. while populating the rad grid with records on clicking on button. its really gives me big problem with performance. I need to wait for long time to start working on the records populated on grid. This gives me problem even with small amount of records and also with more records. i want to have help for this as soon as possible. very urgent.

Thanks
R. Vikram Goud
Yavor
Telerik team
 answered on 26 Nov 2008
1 answer
104 views
Found a minor problem in the format stripper dropdown. After using the format stripper, the selected item is highlighted when the list is dropped down again. In the 'Default' and 'Telerik' skins, this highlight is not correct (looks like a tiled button background image). I tried a few other skins, and it looks ok, but I didn't try them all.
Rumen
Telerik team
 answered on 26 Nov 2008
7 answers
226 views


Hi,

I'm having some issue to bind activitydate and products in this example to bind to grid control in normal mode.Please help.Thanks







<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %> 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="system_engines_myactivity_Default" %> 
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head id="Head1" runat="server">  
    <title>Untitled Page</title> 
</head> 
 
<script language="JavaScript">  
     
      
</script> 
<body > 
    <form id="form1" runat="server">  
    <div> 
      
    </div> 
      
      
 
      
    <telerik:RadScriptManager ID="ScriptManager5" runat="server" /> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadGrid1">  
              
                  <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                  </UpdatedControls> 
            </telerik:AjaxSetting> 
              
              <telerik:AjaxSetting AjaxControlID="RadGrid2">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel2"/>  
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
          
        </AjaxSettings>     
      
    </telerik:RadAjaxManager> 
      
     <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="20">  
            <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;" /> 
     </telerik:RadAjaxLoadingPanel> 
 
        
      <asp:DropDownList ID="ddDateSpan"    
               runat="server" AutoPostBack="true" OnSelectedIndexChanged="DateSpan_SelectedIndexChanged">  
         
         
      </asp:DropDownList> 
        
      <telerik:RadGrid DataSourceID="SqlDataSource1" Skin="Vista" AllowAutomaticDeletes="true" 
            AllowAutomaticInserts="true" AllowAutomaticUpdates="true" ID="RadGrid1" runat="server"   
               OnItemCreated="RadGrid1_ItemCreated" onItemDataBound="RadGrid1_ItemDataBound"  > 
              
            <MasterTableView DataKeyNames="key" Width="100%" CommandItemDisplay="Top" 
                AutoGenerateColumns="false">  
                <Columns> 
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">  
                        <ItemStyle Width="50px" /> 
                    </telerik:GridEditCommandColumn> 
                      
                 
                    <telerik:GridBoundColumn UniqueName="Notes"  SortExpression="Notes" HeaderText="Task Notes" 
                            DataField="Notes"  ColumnEditorID"GridTemplateColumnEditor1"  > 
                    </telerik:GridBoundColumn> 
                      
                    <telerik:GridDropDownColumn    DataField="activity_id"  UniqueName="ActivityTypeID"   HeaderText="Activity Type" 
                             ListTextField="display" ListValueField="item_pk"  ColumnEditorID="DropDownEditor1" 
                             
                             DataSourceID="SqlDataSource_ActivityType"   > 
                     </telerik:GridDropDownColumn> 
                       
                     <telerik:GridDropDownColumn  DataField="product_id"  UniqueName="productgroup" HeaderText="Products" ListTextField="product" 
                     ListValueField="obj_id" ColumnEditorID="DropDownEditor_product"    
                      > 
                       
                     </telerik:GridDropDownColumn> 
                       
                     <telerik:GridDropDownColumn   DataField="budget_id"  UniqueName="BudgetID"   HeaderText="Budget" 
                             ListTextField="display" ListValueField="id"  ColumnEditorID="DropDownEditor2" 
                             
                             DataSourceID="SqlDataSource_Budget"  > 
                     </telerik:GridDropDownColumn> 
                       
                     <telerik:GridDropDownColumn  DataField="activitydate" UniqueName="DateID" HeaderText="Activity Date"   
                      ColumnEditorID="DropDownEditor_Date" 
                      > 
                          
                       
                     </telerik:GridDropDownColumn>   
                   
                
                    
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 
          
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            UpdateCommand="update [user.multi.activity] set [Notes]=@notes,[activity_id]=@activity_id,budget_id=@budget_id ,product_id=@product_id,activitydate=@activitydate where [key]=@key" 
            InsertCommand="insert into [user.multi.activity] (Notes,activity_id,budget_id,product_id,activitydate,user_id,timespan_id) values(@Notes,@activity_id,@budget_id,@product_id,@activitydate,{0},{1})" 
               
                ConnectionString="<%$ ConnectionStrings:ConString %>"   > 
              
            <UpdateParameters> 
                <asp:Parameter Name="Notes" Type="string" /> 
                 
                <asp:Parameter  Name="activity_id" Type="Int32"  /> 
                <asp:Parameter  Name="budget_id" Type="Int32"  /> 
                <asp:Parameter  Name="product_id" Type="Int32"  /> 
                <asp:Parameter Name="activitydate" Type="String" /> 
                <asp:Parameter Name="key" Type="Int32" />                 
              
            </UpdateParameters> 
            <InsertParameters> 
                <asp:Parameter Name="Notes" Type="string" /> 
                <asp:Parameter Name="activity_id" Type="Int32"  />                
                <asp:Parameter  Name="product_id" Type="Int32"  /> 
                <asp:Parameter Name="activitydate" Type="String" /> 
                <asp:Parameter Name="timespan_id" Type="Int32" /> 
                  
            </InsertParameters> 
              
              
                 
            
           </asp:SqlDataSource> 
             
         <asp:SqlDataSource ID="SqlDataSource_ActivityType" runat="server" 
              
            SelectCommand="SELECT  item_pk,display FROM [escworks.item] where itemgroup_id=187"   
             
              ConnectionString="<%$ ConnectionStrings:ConString %>"   > 
             
          
           </asp:SqlDataSource> 
             
           <asp:SqlDataSource ID="SqlDataSource_Budget" runat="server" 
              
            SelectCommand="SELECT -1 as [id],'please choose' as [display],'-1' as [sort] UNION SELECT [budget].[obj_id] as [ID], [budget].[accountnumber] + ' ' + [budget].[description] as [display], [budget].[description] as [sort] FROM [escworks.object] [primary] INNER JOIN [budget] [budget] ON [primary].[obj_pk] = [budget].[obj_id] INNER JOIN [user.multi.budget] [user] ON [budget].[obj_id] = [user].[budget_id] WHERE (([user].[enabled] = 1) )  "   
             
             ConnectionString="<%$ ConnectionStrings:ConString %>"   > 
             
          
           </asp:SqlDataSource> 
             
            
              
              
             
            
              
                
                   
             
              
                    
             
              
                 
              
          
          
             
          
             
         
          
 
     <asp:Button ID="btnNext" runat="server" Text="Next" OnClick="GetStatus_Next">  
          
        </asp:Button> 
      <asp:Button ID="btnBack" runat="server" Text="Previous" OnClick="GetStatus_Previous" Visible=false>  
          
        </asp:Button> 
          
          
      
      
    </form> 
</body> 
</html> 

 
using System;  
using System.Data;  
using System.Configuration;  
using System.Collections;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using Telerik.Web.UI;  
using System.Collections.Generic;  
using System.Collections.Specialized;  
using System.Data.SqlClient;  
 
 
public partial class system_engines_myactivity_Default : System.Web.UI.Page  
{  
 
    protected string Constring = "";  
    protected int span_id;  
    protected void Page_Load(object sender, EventArgs e)  
    {  
 
 
        PopulateDateSpan();  
        span_id = Convert.ToInt32(ddDateSpan.SelectedItem.Value);  
        SqlDataSource1.InsertCommand = string.Format(SqlDataSource1.InsertCommand, Convert.ToInt32(escWorks.Configuration.CurrentUser.UserId.ToString()), span_id);  
 
        SqlDataSource1.SelectCommand = "SELECT  [key],activitydate,activity_id,product_id,budget_id,notes FROM [user.multi.activity] where user_id = " + escWorks.Configuration.CurrentUser.UserId.ToString() + "and timespan_id=" + span_id;  
 
 
    }  
 
    protected override void OnInit(EventArgs e)  
    {  
        base.OnInit(e);  
 
        ddDateSpan.ID = "ddDateSpan";  
 
 
        ServerConnection.ConnectionService ConObj = new ServerConnection.ConnectionService();  
        Constring = "";  
 
        InitializeComponent();  
    }  
 
    private void InitializeComponent()  
    {  
        this.RadGrid2.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(this.RadGrid2_NeedDataSource);  
        this.Load += new System.EventHandler(this.Page_Load);  
 
    }  
 
 
 
 
    protected void DateSpan_SelectedIndexChanged(object sender, System.EventArgs e)  
    {  
 
 
        RadGrid1.DataBind();  
 
 
    }  
 
    protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)  
    {  
 
        if (e.Item is GridDataItem && e.Item.IsInEditMode)  
        {  
            GridDropDownListColumnEditor list = (e.Item as GridEditableItem).EditManager.GetColumnEditor("ActivityTypeID"as GridDropDownListColumnEditor;  
 
 
 
 
        }  
 
        else if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
        {  
            //product by activity type  
            GridDropDownListColumnEditor list = (e.Item as GridEditableItem).EditManager.GetColumnEditor("ActivityTypeID"as GridDropDownListColumnEditor;  
 
            RadComboBox ddlActivity = list.ComboBoxControl;  
            ddlActivity.AutoPostBack = true;  
            ddlActivity.SelectedIndexChanged += list_SelectedIndexChanged;  
 
            //activity date by datespan  
            GridDropDownListColumnEditor list2 = (e.Item as GridEditableItem).EditManager.GetColumnEditor("DateID"as GridDropDownListColumnEditor;  
 
            RadComboBox ddlDate = list2.ComboBoxControl;  
 
            if (ddDateSpan.SelectedIndex == 1)  
            {  
 
 
                string[] ddArray = ddDateSpan.SelectedItem.Text.Split('-');  
                DateTime ddStartDate = Convert.ToDateTime(ddArray[0].ToString());  
                DateTime ddEndDate = Convert.ToDateTime(ddArray[1].ToString());  
                int ddStartDay = ddStartDate.Day;  
                int ddEndDay = ddEndDate.Day;  
 
                for (int i = ddStartDay; i <= ddEndDay; i++)  
                {  
                    ddlDate.Items.Add(new RadComboBoxItem(ddStartDate.Month.ToString() + "/" + i + "/" + ddStartDate.Year.ToString(), ddStartDate.Month.ToString() + "/" + i + "/" + ddStartDate.Year.ToString()));  
 
                }  
            }  
            else if (ddDateSpan.SelectedIndex == 0)  
            {  
                string[] ddArray = ddDateSpan.SelectedItem.Text.Split('-');  
                DateTime ddStartDate = Convert.ToDateTime(ddArray[0].ToString());  
                DateTime ddEndDate = Convert.ToDateTime(ddArray[1].ToString());  
                int ddStartDay = ddStartDate.Day;  
                int ddEndDay = ddEndDate.Day;  
 
                for (int i = ddStartDay; i <= ddEndDay; i++)  
                {  
                    ddlDate.Items.Add(new RadComboBoxItem(ddStartDate.Month.ToString() + "/" + i + "/" + ddStartDate.Year.ToString(), ddStartDate.Month.ToString() + "/" + i + "/" + ddStartDate.Year.ToString()));  
 
                }  
 
            }  
 
        }  
 
    }  
 
 
 
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if (e.Item is GridDataItem && !e.Item.IsInEditMode)  
        {  
 
            GridDropDownListColumnEditor dateColumnEditor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor("DateID"as GridDropDownListColumnEditor;  
 
            RadComboBox activitiess = dateColumnEditor.ComboBoxControl;  
 
 
            if (DataBinder.Eval(e.Item.DataItem, "activitydate").ToString() != string.Empty)  
            {  
                string sss = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "activitydate")).ToShortDateString();  
 
                string activity = string.Empty;  
                if (sss != string.Empty)  
                {  
                      
                }  
 
            }  
 
 
            GridDropDownListColumnEditor activityColumnEditor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor("ActivityTypeID"as GridDropDownListColumnEditor;  
 
            RadComboBox activities = activityColumnEditor.ComboBoxControl;  
 
            string ss = DataBinder.Eval(e.Item.DataItem, "activity_id").ToString();  
 
            int? activityId = null;  
            if (ss != string.Empty)  
            {  
                activityId = (int)DataBinder.Eval(e.Item.DataItem, "activity_id");  
                 
            }  
 
            if (activityId != null)  
            {  
                GridDropDownListColumnEditor productColumnEditor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor("productgroup"as GridDropDownListColumnEditor;  
 
                RadComboBox productsCombo = productColumnEditor.ComboBoxControl;  
                productColumnEditor.DataSource = GetProductByActivity();//GetProductsByCategory(categoryId.GetValueOrDefault());  
                 
            }  
 
        }  
        else if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
        {  
            //activity type  
            GridDropDownListColumnEditor activityColumnEditor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor("ActivityTypeID"as GridDropDownListColumnEditor;  
 
            RadComboBox activities = activityColumnEditor.ComboBoxControl;  
            
            string ss = DataBinder.Eval(e.Item.DataItem, "activity_id").ToString();  
 
            int? activityId = null;  
            if (activities.Items.Count > 0 && ss != string.Empty)  
            {  
                activityId = (int)DataBinder.Eval(e.Item.DataItem, "activity_id");  
                 
            }  
 
            if (activityId != null)  
            {  
                GridDropDownListColumnEditor productColumnEditor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor("productgroup"as GridDropDownListColumnEditor;  
 
                RadComboBox productsCombo = productColumnEditor.ComboBoxControl;  
                productColumnEditor.DataSource = GetProductByActivity();//GetProductsByCategory(categoryId.GetValueOrDefault());  
                productColumnEditor.DataBind();  
 
 
                if (productsCombo.Items.Count > 0)  
                {  
 
                    productsCombo.FindItemByValue(DataBinder.Eval(e.Item.DataItem, "product_id").ToString()).Selected = true;  
                }  
            }  
 
 
            GridDropDownListColumnEditor dateColumnEditor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor("DateID"as GridDropDownListColumnEditor;  
 
            RadComboBox activitiess = dateColumnEditor.ComboBoxControl;  
 
            activitiess.Items.Clear();  
            activitiess.Items.Add(new RadComboBoxItem("Choose one"""));  
 
 
            if (ddDateSpan.SelectedIndex == 0)  
            {  
                string[] ddArray = ddDateSpan.SelectedItem.Text.Split('-');  
                DateTime ddStartDate = Convert.ToDateTime(ddArray[0].ToString());  
                DateTime ddEndDate = Convert.ToDateTime(ddArray[1].ToString());  
                int ddStartDay = ddStartDate.Day;  
                int ddEndDay = ddEndDate.Day;  
 
                for (int i = ddStartDay; i <= ddEndDay; i++)  
                {  
                    activitiess.Items.Add(new RadComboBoxItem(ddStartDate.Month.ToString() + "/" + i + "/" + ddStartDate.Year.ToString(), ddStartDate.Month.ToString() + "/" + i + "/" + ddStartDate.Year.ToString()));  
 
                }  
            }  
            else 
            {  
                string[] ddArray = ddDateSpan.SelectedItem.Text.Split('-');  
                DateTime ddStartDate = Convert.ToDateTime(ddArray[0].ToString());  
                DateTime ddEndDate = Convert.ToDateTime(ddArray[1].ToString());  
                int ddStartDay = ddStartDate.Day;  
                int ddEndDay = ddEndDate.Day;  
 
                for (int i = ddStartDay; i <= ddEndDay; i++)  
                {  
                    activitiess.Items.Add(new RadComboBoxItem(ddStartDate.Month.ToString() + "/" + i + "/" + ddStartDate.Year.ToString(), ddStartDate.Month.ToString() + "/" + i + "/" + ddStartDate.Year.ToString()));  
 
                }  
 
            }  
 
 
            if (DataBinder.Eval(e.Item.DataItem, "activitydate").ToString() != string.Empty)  
            {  
                string sss = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "activitydate")).ToShortDateString();  
 
                string activity = string.Empty;  
                if (activities.Items.Count > 0 && sss != string.Empty)  
                {  
 
                    activitiess.SelectedIndex = activitiess.Items.IndexOf(activitiess.Items.FindItemByValue(sss));  
                }  
            }  
 
 
 
 
        }  
    }  
 
 
    
   
    
 
    //onItemCreated  
    private void list_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)  
    {  
        GridEditableItem item = ((Control)sender).NamingContainer as GridEditableItem;  
 
        RadComboBox ddlProduct = item["productgroup"].Controls[0] as RadComboBox;  
        ddlProduct.Items.Clear();  
 
        if (e.Text == "Product")  
        {  
 
            ddlProduct.Items.Add(new RadComboBoxItem("Select One""-1"));  
            foreach (DataRow dr in GetProductByActivity().Rows)  
            {  
                ddlProduct.Items.Add(new RadComboBoxItem(dr["product"].ToString(), dr["obj_id"].ToString()));  
 
 
            }  
 
        }  
 
    }  
 
    //OnItemCreated  
    // product datasource  
    private DataTable GetProductByActivity()  
    {  
 
        SqlConnection newSqlConnection = new SqlConnection(Constring);  
        SqlDataAdapter SQLda = new SqlDataAdapter();  
 
 
 
        using (SQLda.SelectCommand = new SqlCommand("SELECT obj_id as obj_id,[description] as [product] FROM project", newSqlConnection))  
        {  
            DataTable myDataTable = new DataTable();  
            newSqlConnection.Open();  
 
            try 
            {  
                SQLda.Fill(myDataTable);  
                return myDataTable;  
 
            }  
 
            finally 
            {  
                newSqlConnection.Close();  
 
            }  
 
        }  
 
 
    }  
 
    //onItemDataBound  
    protected DataTable GetActivity()  
    {  
        return ((DataView)SqlDataSource_ActivityType.Select(new DataSourceSelectArguments())).Table;  
    }  
 
 
     
    public void GetStatus_Next(object sender, System.EventArgs e)  
    {  
        RadGrid1.Visible = false;  
        RadGrid2.Visible = true;  
        btnNext.Visible = false;  
        btnBack.Visible = true;  
 
        RadGrid2.MasterTableView.EditMode = GridEditMode.InPlace;  
        int i = 0;  
        foreach (GridDataItem GridItem in RadGrid1.Items)  
        {  
 
            using (SqlCommand SQLCommand = new SqlCommand("[system/engines/myactivity/default/updategriditems]"new SqlConnection(Constring)))  
            {  
                SQLCommand.CommandType = CommandType.StoredProcedure;  
 
 
 
 
                SQLCommand.Parameters.Add("@key", SqlDbType.Int, 4).Value = RadGrid1.Items[0].OwnerTableView.DataKeyValues[GridItem.ItemIndex]["key"];  
                SQLCommand.Parameters.AddWithValue("@sid", escWorks.Configuration.CurrentUser.Identity);  
                SQLCommand.Parameters.AddWithValue("@user_id", escWorks.Configuration.CurrentUser.UserId);  
                SQLCommand.Parameters.AddWithValue("@datespan_id", ddDateSpan.SelectedItem.Value);  
 
                SQLCommand.Connection.Open();  
 
                try 
                {  
                    SQLCommand.ExecuteNonQuery();  
                    i++;  
                }  
 
                catch (Exception ex)  
                {  
                    Response.Write(ex.Message);  
 
                }  
 
                finally 
                {  
                    if (SQLCommand.Connection.State != ConnectionState.Closed)  
                        SQLCommand.Connection.Close();  
 
                }  
 
 
            }  
 
        }  
 
 
    }  
 
    public void GetStatus_Previous(object sender, System.EventArgs e)  
    {  
        RadGrid1.Visible = true;  
        RadGrid2.Visible = false;  
        btnNext.Visible = true;  
        btnBack.Visible = false;  
 
 
 
 
 
    }  
     
 
    private void PopulateDateSpan()  
    {  
        ddDateSpan.DataSource = GetActivityDateSpan();  
        ddDateSpan.DataTextField = "display";  
        ddDateSpan.DataValueField = "key";  
        ddDateSpan.DataBind();  
 
        ddDateSpan.SelectedIndex = ddDateSpan.Items.IndexOf(ddDateSpan.Items.FindByValue(Request.Form["ddDateSpan"]));  
 
 
 
    }  
 
    private DataSet GetActivityDateSpan()  
    {  
        using (SqlCommand SQLCommand = new SqlCommand("system/engines/myactivity/default/datespan"new SqlConnection(Constring)))  
        {  
            SQLCommand.CommandType = CommandType.StoredProcedure;  
            SQLCommand.Connection.Open();  
 
            try 
            {  
                DataSet SQLds = new DataSet("result");  
 
                SqlDataAdapter SQLda = new SqlDataAdapter(SQLCommand);  
 
                SQLda.Fill(SQLds);  
 
                return SQLds;  
            }  
 
            catch (Exception ex)  
            {  
                return null;  
                Response.Write(ex.Message);  
            }  
 
            finally 
            {  
                if (SQLCommand.Connection.State != ConnectionState.Closed)  
                    SQLCommand.Connection.Close();  
 
            }  
 
 
        }  
 
    }  
 
 
}  
 
Iana Tsolova
Telerik team
 answered on 26 Nov 2008
4 answers
231 views
I want to use the GridDropDownColumn in the edit form of a grid in a way that it gets its values from a table with two columns (product_id, product_name) but the user sees only the product name.
The insert or update command should enter to another table I use only the product_id values.
Thank you very much!
Nikolay Rusev
Telerik team
 answered on 26 Nov 2008
1 answer
173 views
Hi, i have into a db the column recurrence_rule for the recurring appointment

Example:

DTSTART:20081124T090000Z
DTEND:20081124T100000Z
RRULE:FREQ=WEEKLY;UNTIL=20081227T000000Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;WKST=MO

I would you like to convert this in a format standard

Example:

11/24/2007 3:30:00 PM
11/24/2007 5:30:00 PM
....

I try to view a example : http://www.telerik.com/help/aspnet-ajax/schedule_serversideworkingwithrecurringappointments.html

But i would you like to convert this recurrence_rule by database in radschedulerappointment_Created

My code:

  Dim oRicurrence As Label = CType(e.Container.FindControl("LbRecurrence"), Label)

        If e.Appointment.Attributes("Recurrence_rule") = "" Then

        Else

            Dim rule As HourlyRecurrenceRule = e.Appointment.Attributes("Recurrence_rule")

            For Each occurrence As DateTime In rule.Occurrences
                Console.WriteLine("" & Chr(9) & "{0}", occurrence)
           
Next

        End If

Is similar but  how i can to make the same example of (Working with Recurring Appointments) with a recurrence_rule column that is into db?





Peter
Telerik team
 answered on 26 Nov 2008
1 answer
115 views
Hi,
i'm trying to implement a simple demo you wrote on this address:
http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/GeneralFeatures/CalculatedColumns/DefaultCS.aspx

With the change that I implement the code in a control. You can assume the control inherits <scriptManager>. The page that loads the control does that thorugh the TabStrip comp.

The problem is that when I try to filter the data using the GUI, I get an error: "Object reference is not set to an object". When I put the same code in a single ASPX file, It works fine. I had several problems with grid examples in your site when I tried to include them as controls.

Can you please check it out?
        <!-- content start --> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadGrid1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <telerik:RadGrid ShowGroupPanel="true" AutoGenerateColumns="false" ID="RadGrid1" 
            DataSourceID="SqlDataSource1" Skin="Vista" AllowFilteringByColumn="True" AllowSorting="True" 
            ShowFooter="True" runat="server" GridLines="None" AllowPaging="true"
            <PagerStyle Mode="NextPrevAndNumeric" /> 
            <MasterTableView AllowMultiColumnSorting="true"
                <Columns> 
                    <telerik:GridBoundColumn Aggregate="Count" DataField="id" HeaderText="Product ID" 
                        FooterText="Total products: "
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="title" HeaderText="Product name" SortExpression="title" 
                        UniqueName="title"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn Aggregate="Sum" DataField="price" HeaderText="Unit price" 
                        FooterText="Total price: "
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn Aggregate="Sum" DataField="amount" HeaderText="Units in stock" 
                        FooterText="All units in stock: "
                    </telerik:GridBoundColumn> 
                    <telerik:GridCalculatedColumn HeaderText="Total Price" UniqueName="TotalPrice" DataType="System.Double" 
                        DataFields="price, amount" Expression="{0}*{1}" FooterText="Total : " Aggregate="Sum" /> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true" /> 
        </telerik:RadGrid> 
        <asp:Button ID="Button1" Text="PostBack!" CssClass="button" Style="margin: 10px 22px 10px 0px" 
            runat="server"></asp:Button> 
        Click PostBack to see the state of the grid is preserved. 
        <br /> 
        <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="Data Source=vmsmc;Initial Catalog=hadar;User ID=sa" 
            SelectCommand="SELECT * FROM tblProducts" runat="server"></asp:SqlDataSource> 
    </div> 
 



Sebastian
Telerik team
 answered on 26 Nov 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?