Exemple #1
0
        /// <summary>
        /// Gets the dymanic data request URL.
        /// </summary>
        /// <param name="grid">The grid.</param>
        /// <returns></returns>
        public static string GetDymanicDataRequestUrl(DynamicGrid grid)
        {
            StringBuilder builder = new StringBuilder(GetHadlerURL(_handlerKeyDataSource));

            builder.Append("&" + _dynamicDataColumnCount + "=" + grid.Columns.Count);

            if (!string.IsNullOrEmpty(grid.AssociatedDataKey))
            {
                builder.Append("&" + _dymanicDataType + "=" + HttpUtility.UrlEncode(grid.AssociatedDataKey));
            }


            if (!string.IsNullOrEmpty(grid.DataSourceID))
            {
                DynamicGridDataSource dataSource = ControlHelper.FindControl(grid, grid.DataSourceID) as DynamicGridDataSource;
                builder.AppendFormat("&{0}={1}",
                                     _dymanicDataSourceId,
                                     dataSource == null ? grid.DataSourceID : HttpUtility.UrlEncode(dataSource.ClientID));
            }

            if (!string.IsNullOrEmpty(grid.AdditionalXmlQueryParams))
            {
                builder.Append("&" + grid.AdditionalXmlQueryParams);
            }
            return(builder.ToString());
        }
Exemple #2
0
 private void GetDataFromDataSource(DataRequestEventArgs args, string dataSourceId)
 {
     if (!string.IsNullOrEmpty(dataSourceId))
     {
         dataSourceId = dataSourceId.Replace('_', '$');
         DynamicGridDataSource dataSource = (DynamicGridDataSource)FindControl(dataSourceId);
         if (dataSource == null)
         {
             OnDataSourceNotFound(dataSourceId);
             dataSource = (DynamicGridDataSource)FindControl(dataSourceId);
         }
         if (dataSource != null)
         {
             Response.Write(dataSource.GetDataXml(args));
         }
     }
     else
     {
         OnGetGridXmlData(args);
     }
 }
Exemple #3
0
 /// <summary>
 /// Adds the data source.
 /// </summary>
 /// <param name="source">The source.</param>
 public void AddDataSource(DynamicGridDataSource source)
 {
     Controls.Add(source);
 }