Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
133 views

Hi!

I have a radgrid is configured as following:
<

telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" Skin="Vista">
<MasterTableView DataKeyNames="SchematicDescriptionId"
AllowFilteringByColumn="true" AllowSorting="True" AllowCustomPaging="true" AllowPaging="True" PagerStyle-Mode="NextPrevAndNumeric" PageSize="10" CommandItemDisplay="Top" EditMode="EditForms" AllowAutomaticInserts="true" CommandItemSettings-AddNewRecordText="New Description" CommandItemSettings-RefreshText=""><Columns>.....</Columns></MasterTableView></telerik:RadGrid>

I have also a dropdownlist. Everytime I select an item in this dropdownlist, datasource of RadGrid1 will be changed. The issue is datasource comes from the 1st item of dropdownlist has 18 rows (for example) and datasource's 2nd item if dropdownlist has only 1 row. But I don't know why Paging section alway show "Displaying page 1 of 2, items 1 to 10 of 18." while the 2nd datasource just has 1 row ??? 

Please help me
Thank
Hung

Hung
Top achievements
Rank 1
 answered on 23 May 2008
1 answer
103 views
I have pagging enabled for my RadGrid, when I select the next page, the control moves to the next page but adds two additional coulums with the following data in them: System.Data.DataRowView

My code is below:

protected

void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

}

}

protected void Page_PreRender(object sender, EventArgs e)

{

this.BuildGrid();

}

protected void Page_Init(object source, System.EventArgs e)

{

}

private void BuildGrid()

{

GridBoundColumn boundColumn;

boundColumn = new GridBoundColumn();

boundColumn.DataField = "CountryId";

boundColumn.HeaderText = "Country Number";

this.RadGrid1.MasterTableView.Columns.Add(boundColumn);

boundColumn = new GridBoundColumn();

boundColumn.DataField = "CountryName";

boundColumn.HeaderText = "Country Name";

this.RadGrid1.MasterTableView.Columns.Add(boundColumn);

RadGrid1.Width = Unit.Percentage(50);

RadGrid1.PageSize = 50;

RadGrid1.AllowPaging = true;

RadGrid1.PagerStyle.Mode = Telerik.Web.UI.GridPagerMode.NextPrevNumericAndAdvanced;

RadGrid1.AutoGenerateColumns = false;

RadGrid1.ShowStatusBar = true;

RadGrid1.Skin = "Web20";

RadGrid1.ShowStatusBar = true;

RadGrid1.GridLines = GridLines.Horizontal;

RadGrid1.HorizontalAlign = HorizontalAlign.Left;

RadGrid1.ShowFooter = true;

RadGrid1.ShowHeader = true;

RadGrid1.ShowStatusBar = true;

RadGrid1.AllowSorting = true;

RadGrid1.Visible = true;

this.RadGrid1.DataSource = this.GetData();

this.RadGrid1.DataBind();

}

private DataSet GetData()

{

SqlConnection sqlConnection = new SqlConnection();

SqlCommand sqlCommand = new SqlCommand();

SqlParameter sqlParameter = new SqlParameter();

DataSet dataSet = new DataSet();

try

{

if (sqlConnection.State != ConnectionState.Open)

{

sqlConnection.ConnectionString = SqlConnectionString.GetConnectionString();

sqlConnection.Open();

}

sqlCommand.Connection = sqlConnection;

sqlCommand.CommandType = CommandType.StoredProcedure;

sqlCommand.CommandText = ApplicationStoredProcedures.GetCountries();

sqlCommand.Parameters.Add("@WebPageName", SqlDbType.NVarChar).Value = "Authors.aspx";

sqlCommand.Parameters.Add("@CultureCode", SqlDbType.NVarChar).Value = "en-US";

sqlCommand.Parameters.Add("@ControlName", SqlDbType.NVarChar).Value = "ddlCountry";

sqlCommand.ExecuteNonQuery();

SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);

sqlDataAdapter.Fill(dataSet);

return dataSet;

}

catch (SqlException sql)

{

throw sql;

}

catch (Exception ex)

{

throw ex;

}

finally

{

if (sqlConnection.State != ConnectionState.Closed)

{

sqlConnection.Close();

}

sqlCommand.Dispose();

}

}

public void RadGrid1_PageIndexChanged(object source, Telerik.Web.UI.GridPageChangedEventArgs e)

{

this.RadGrid1.CurrentPageIndex = e.NewPageIndex;

}

/// <summary>

/// You can get the exact numbers of rows in your RadGrid either directly from the DataSource or in the following manner in the ItemDataBound event:

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)

{

if (e.Item is GridPagerItem)

{

Label1.Text = (e.Item as GridPagerItem).Paging.DataSourceCount.ToString();

}

}

 

protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

{

// RadGrid1.DataSource = this.GetData() ;

}

I cannot find the issue. Am I doing something wrong.

Shinu
Top achievements
Rank 2
 answered on 23 May 2008
1 answer
205 views
I am having a number of issues with the RadDatePicker. I have reviewed all the posts i can find, but still cannot get it to work how i need it to.
1. when tabbing, i don't want focus to go to the 'calendar' icon
2. i am using tooltips and cannot get them to work on the raddatepicker
3. i am using onfocus, onblur and cannot get this to work on raddatepicker

here is my code:

<script type="text/javascript">

function Hilite(me, focus)

{

me.style.backgroundColor =

false != focus ? "#ffffcc" : "white";

}

</script>

<style type="text/css">

.ToolTipContent

{

color:black;

}

</style>



<tr>

<td class="Normal" style="padding-left:15px">Registration Start Date<font color="red">*</font></td>

<td>

<telerik:RadDatePicker ID="txtRegistrationStart" Skin="Web20" runat="server" TabIndex="6" ToolTip="Enter the date your online registrations will end.">

<DateInput ID="DateInput1" runat="server" ClientEvents-OnBlur="Hilite(this,false)" ClientEvents-OnFocus="Hilite(this)" /></telerik:RadDatePicker>

<asp:requiredfieldvalidator cssclass="Normal" controltovalidate="txtRegistrationStart" errormessage="Required." display="dynamic" runat="server" ID="Requiredfieldvalidator2"/></td></tr>

 

<telerik:RadToolTipManager runat="server" ID="RadToolTipManager1"

 

ShowEvent="OnFocus"

 

Skin="WebBlue"

 

ShowDelay="0"

 

AutoCloseDelay="5000"

Width="250px"

 

Position="MiddleRight"

 

RelativeTo="Element">

<TargetControls>

 

<telerik:ToolTipTargetControl TargetControlID="cmbSport"/>

 

<telerik:ToolTipTargetControl TargetControlID="txtSeasonName"/>

 

<telerik:ToolTipTargetControl TargetControlID="txtRegistrationStart"/>

 

<telerik:ToolTipTargetControl TargetControlID="txtRegistrationEnd"/>

 

<telerik:ToolTipTargetControl TargetControlID="txtCoachAppStart"/>

<telerik:ToolTipTargetControl TargetControlID="txtCoachAppEnd"/>

<telerik:ToolTipTargetControl TargetControlID="txtAgeAsOf"/>

</TargetControls>

</telerik:RadToolTipManager>

Thanks so much!
Susan


Iana Tsolova
Telerik team
 answered on 23 May 2008
1 answer
189 views
We are using a Red Menu with a datepicker on it.  The datepicker shows up behind the menu.  I tried setting the zindex  of the calendar on the datepicker, but this did not help.    For testing purposes, I used a CalendarExtendar from the AjaxControlToolkit and it worked fine.  Any help is appreciated.

<telerik:RadMenu ID="RadMenu1" runat="server" Skin="Web20" Flow="Horizontal" EnableScreenBoundaryDetection="true" 
                            EnableOverlay="true" Width="300px"> 
                            <Items> 
                                <telerik:RadMenuItem Text="Apr 15, 2008 - May 15,2008" GroupSettings-Flow="Horizontal" 
                                    Width="100%"> 
                                    <Items> 
                                        <telerik:RadMenuItem> 
                                            <ItemTemplate> 
                                                <table style="height: 400px;"> 
                                                    <tr> 
                                                        <td> 
                                                            <telerik:RadDatePicker ID="rdpBeginDate" runat="server" Skin="Mac" Calendar-Orientation="RenderInColumns" 
                                                                Calendar-CellVAlign="top"> 
                                                            </telerik:RadDatePicker> 
                                                        </td> 
                                                    </tr> 
                                                </table> 
                                            </ItemTemplate> 
                                        </telerik:RadMenuItem> 
                                    </Items> 
                                </telerik:RadMenuItem> 
                            </Items> 
                        </telerik:RadMenu> 

Rosen
Telerik team
 answered on 23 May 2008
1 answer
230 views
very strange.
standard Gridview
Calling DateTime column with valid DateTime data from SQL ds. Update works fine when a textbox.

<

EditItemTemplate>

<telerik:RadDateTimePicker ID="RadDateTimePicker2" runat="server" AutoPostBackControl='<%# Eval("EducationDate") %>'

Culture="English (United States)">

<DateInput InvalidStyleDuration="100">

</DateInput>

</telerik:RadDateTimePicker>

</EditItemTemplate>

error returned = 

Conversion from type 'Date' to type 'Integer' is not valid.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Conversion from type 'Date' to type 'Integer' is not valid.

Source Error:

Line 25:                 <asp:TemplateField HeaderText="EducationDate" SortExpression="EducationDate">
Line 26:                     <EditItemTemplate>
Line 27: &nbsp;<telerik:RadDateTimePicker ID="RadDateTimePicker2" runat="server" AutoPostBackControl='<%# Eval("EducationDate") %>'Line 28:                             Culture="English (United States)">
Line 29:                             <DateInput InvalidStyleDuration="100">

Steve
Telerik team
 answered on 23 May 2008
1 answer
122 views


Hi,

The other day I was thinking... it'd sure be nice if there were a centeral place to set the "default" skin that all RadGrids would use. Maybe there could be a "RadGridMaster" class? Then you could set the skin once, and every RadGrid instance would "inherit" from it...

Similarly, RadComboboxMaster, RadSplitterMaster, etc...

Similarly, for lots of other settings beyond skins.

--Bill



There are other things that we set on every-single-grid... For example:

myGrid.PagerStyle.PagerTextFormat = Resources.

Documents.Pages_45Items;

myGrid.PagerStyle.AlwaysVisible =

true;

myGrid.PagerStyle.HorizontalAlign =

HorizontalAlign.Right;

myGrid.PagerStyle.Mode =

GridPagerMode.NextPrevNumericAndAdvanced;

myGrid.MasterTableView.TableLayout =

GridTableLayout.Fixed;

myGrid.MasterTableView.NoMasterRecordsText = Resources.

Atlas.NoItems;

myGrid.MasterTableView.NoDetailRecordsText = Resources.

Atlas.NoItems;

myGrid.MasterTableView.SortExpressions.AllowNaturalSort =

false;

myGrid.AutoGenerateColumns =

false;

myGrid.ClientSettings.Resizing.EnableRealTimeResize =

false;


Dimo
Telerik team
 answered on 23 May 2008
1 answer
150 views
Hi

I am trying to bind a chart to a Xml Document object but have been unable to get it working successfully.

I am following the example in the documentation for binding to an Xml file and this is working without problem.

RadChart1.DataSource = Server.MapPath("~/Products.xml"); 
RadChart1.Series[0].DataYColumn = "QuantityInStock"; 
RadChart1.PlotArea.XAxis.DataLabelsColumn = "Name"; 
RadChart1.DataBind(); 

However if I attempt to bind to an XML document I am getting the following error "Column 'IsEmpty' does not belong to table". 

I am using the following code to build the Xml document:
StringBuilder sb = new StringBuilder(); 
StringWriter sw = new StringWriter(sb); 
XmlTextWriter writer = new XmlTextWriter(sw); 
 
writer.Formatting = Formatting.Indented; 
 
writer.WriteStartDocument(); 
writer.WriteStartElement("Products", null); 
 
writer.WriteStartElement("Product", null); 
writer.WriteAttributeString("Name", "Parka L"); 
writer.WriteAttributeString("QuantityInStock", "123"); 
writer.WriteEndElement(); 
 
writer.WriteStartElement("Product", null); 
writer.WriteAttributeString("Name", "Parka M"); 
writer.WriteAttributeString("QuantityInStock", "56"); 
writer.WriteEndElement(); 
 
writer.WriteStartElement("Product", null); 
writer.WriteAttributeString("Name", "Parka S"); 
writer.WriteAttributeString("QuantityInStock", "92"); 
writer.WriteEndElement(); 
 
writer.WriteStartElement("Product", null); 
writer.WriteAttributeString("Name", "Mittens"); 
writer.WriteAttributeString("QuantityInStock", "12"); 
writer.WriteEndElement(); 
 
writer.WriteEndElement(); 
writer.Flush(); 
 
XmlDocument xmlDocs = new XmlDocument(); 
xmlDocs.LoadXml(sb.ToString()); 
 
RadChart1.DataSource = xmlDocs; 
RadChart1.Series[0].DataYColumn = "QuantityInStock"; 
RadChart1.PlotArea.XAxis.DataLabelsColumn = "Name"; 
RadChart1.DataBind(); 

Any suggestions as to what is going wrong?

Thanks

Colin
Giuseppe
Telerik team
 answered on 23 May 2008
3 answers
193 views
Hi,

With grid rows having a select column, how could we have "Select All" and "Clear selection" functionality? Can we do this on the client-side?

Regards,
Shinu
Top achievements
Rank 2
 answered on 23 May 2008
7 answers
206 views
Are there any good examples of using the NestedViewTemplate?  My problem is this: 

I've created a Template and assigned it to a grid. No problems there, test contents of the template (a label) rendered fine.  Now what I'm trying to do is render the DetailTables inside the template.  I pass in the MasterTableView of the grid in order to have access to the child views.  Any way to use those existing views to create the child grids, or at least render the views? 
Sebastian
Telerik team
 answered on 23 May 2008
1 answer
164 views
Hi,

Im trying to export data from a radGrid. The data displayed is set using a filterExpression on the datasource.

However when i export the grid to excel it is exporting all the values from the datasource, not just the values that meet the filterexpression criteria (those being displayed).

Any ideas whats going on?

Shinu
Top achievements
Rank 2
 answered on 23 May 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?