Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
119 views
Hello,
I'm creating dynamic radgrid with dynamic columns names. The names all come from the database and can be either in English or in French. When a column's name contain a french character such as é à è ê ç... or if it contain ' or - a space is automatically added after the character witch odd result such as:
"Remplaç
ant"
or
"Anné
e"
or
"sous
-
code"
I tried to prevent text wraping this way:
grid.HeaderStyle.Wrap = false;
This way I don't get odd wrapping, but I still get space after those character, so it now looks like:
"Remplaç ant"
"Anné e"
"sous- code"
It's a little bit better but far from acceptable. The data binding is done this way (table been a DataTable):
grid.DataSource = table;
I tried to use Server.HtmlEncode() to make sure that the string is in the right format, but no luck... Since I'm using a DataTable, I don't think I can use TextBlock.  Any idea?

Thanks,
LP
Marco
Top achievements
Rank 1
 answered on 07 Feb 2011
1 answer
84 views
when i try to replace GridTemplateColumns with my customFilteredGridTemplateColumns the RadGrid isnt shown due to many bugs which seems irrelevant to Rad objects at all. what am i doing wrong? here is my implementation:

 

 

public class CustomFilteredGridTemplateColumn : GridTemplateColumn

 

{

 

 

public override GridColumn Clone()

 

{

 

 

return base.Clone();

 

}

 

 

protected override void SetupFilterControls(System.Web.UI.WebControls.TableCell cell)

 

{

 

 

base.SetupFilterControls(cell);

 

cell.Controls.RemoveAt(0);

cell.Controls.AddAt(0,

 

new TextBox());

 

}

 

 

public override bool SupportsFiltering()

 

{

 

 

return true;

 

}

 

 

protected override string GetFilterDataField()

 

{

 

 

return this.DataField;

 

}

 

 

protected override void SetCurrentFilterValueToControl(TableCell cell)

 

{

 

 

base.SetCurrentFilterValueToControl(cell);

 

(cell.Controls[0]

 

as TextBox).Text = this.CurrentFilterValue;

 

}

 

 

protected override string GetCurrentFilterValueFromControl(TableCell cell)

 

{

 

 

return (cell.Controls[0] as TextBox).Text;

 

}

}

Pavlina
Telerik team
 answered on 07 Feb 2011
3 answers
120 views
I have a RadGrid with a date column and several text columns and filtering enabled. When I select a date to be filtered, type text in one of the text fields and then select another filter field, the grid filters properly, but I can no longer type in the filter text fields.

I am using RadControls for ASP.NET Ajax Q2 2009.

Any suggestions?

My grid code is:
<telerik:RadGrid ID="ShipmentHistoryGrid" runat="server" Skin="Web20" OnNeedDataSource="OnShipmentHistoryGridNeedDataSource" 
    ShowStatusBar="True" AutoGenerateColumns="False" GridLines="None" OnItemDataBound="OnItemDataBound" 
    AllowFilteringByColumn="true" AllowSorting="true"
    <PagerStyle Mode="NextPrevAndNumeric" /> 
    <MasterTableView DataKeyNames="PackageID" CommandItemDisplay="None" TableLayout="Fixed"
        <Columns> 
            <telerik:GridDateTimeColumn FilterControlWidth="90px" DataField="ShippingDate" UniqueName="Date" 
                HeaderText="Ship Date" DataFormatString="{0:d}" AutoPostBackOnFilter="true" ShowFilterIcon="false"
                <HeaderStyle Width="95px" /> 
            </telerik:GridDateTimeColumn> 
            <telerik:GridBoundColumn DataField="Pin" UniqueName="Pin" HeaderText="Pin" AutoPostBackOnFilter="true" 
                CurrentFilterFunction="Contains" ShowFilterIcon="false" > 
                <HeaderStyle Width="100px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="ShortService" UniqueName="ServiceType" HeaderText="Service" 
                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                <HeaderStyle Width="120px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="Contact" UniqueName="Contact" HeaderText="Name" 
                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                <HeaderStyle Width="100px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="City" UniqueName="City" HeaderText="City" AutoPostBackOnFilter="true" 
                CurrentFilterFunction="Contains" ShowFilterIcon="false"
                <HeaderStyle Width="100px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn FilterControlWidth="30px" DataField="Province" UniqueName="Province" HeaderText="Province" 
                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                <HeaderStyle Width="60px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="PostalCode" UniqueName="PostalCode" HeaderText="Postal Code" 
                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                <HeaderStyle Width="95px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridCheckBoxColumn DataField="IsVoid" UniqueName="IsVoid" Visible="false"
            </telerik:GridCheckBoxColumn> 
            <telerik:GridTemplateColumn UniqueName="VoidColumn" AllowFiltering="false" HeaderText="Void"
                <ItemTemplate> 
                    <asp:Button ID="btnVoid" runat="server" OnClick="OnClickVoid" Text="Void" /> 
                    <asp:Label ID="VoidLabel" runat="server" Text="Package Voided"></asp:Label> 
                </ItemTemplate> 
                <ItemStyle HorizontalAlign="Center"/> 
                <HeaderStyle HorizontalAlign="Center" /> 
            </telerik:GridTemplateColumn> 
        </Columns> 
    </MasterTableView> 
    <ClientSettings> 
        <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
    </ClientSettings> 
</telerik:RadGrid> 
 
Martin
Telerik team
 answered on 07 Feb 2011
3 answers
101 views
hello,

im on an older version of RadControls for ASP.NET AJAX ("2009.2 826") but i think the answer to my question should be pretty straight-forward.

im using a RadGrid that uses WebUserControl for the grid's EditFormType. This .ascx form is displayed for Insertion and Update operations. my question -- in the user control's code-behind, how can i tell which mode the code is being executed as? i use this to show different things if the user is performing an Insert vs. an Update.

currently i use this code in the user control's .ascx.cs:

private void Page_PreRender(object sender, EventArgs e)
{
    //this is the only way i know how to check what mode this grid control is operating in.
    bool isGridInsertion = Object.ReferenceEquals(this.DataItem.GetType(), new GridInsertionObject(new ArrayList()).GetType() );
 
    if (isGridInsertion != true) //we check this because the below int assignment breaks on a grid insertion (since ProductTypeID has no value during our Insert form, only populated on Edit)
    {              
        int productTypeID = (int)DataBinder.Eval(this.DataItem, "ProductTypeID");
 
        // do stuff
    }
}

...is there a better way than doing the Object.ReferenceEquals on the DataItem's type (comparing it to a GridInsertionObject's type) ?


thanks!
matt
Martin
Telerik team
 answered on 07 Feb 2011
1 answer
59 views
Hi,

  I added Radgrid in my user control page...I used UserControl in other aspx pages.... While doing that i dint get Radgrid Header....I want to show Radgrid Header.... what i should do for that......

Thanks & Regards,
Asik
Pavlina
Telerik team
 answered on 07 Feb 2011
2 answers
94 views
Hi,

I got an application with a ListView containing RadControls in InsertItemTemplate.
I would like to propose to the visitor a value in a RadTextBox calculated on value inserted by this visitor in another RadTextBox.
But how can I get access to these fields in js ?
In .Net code behind no problem.. but I don't know how to do that on client side.

Can someone help me on this ?

Regards,

David
Maria Ilieva
Telerik team
 answered on 07 Feb 2011
1 answer
88 views

Hello,

I have requirement to refresh the RADGrid after user download the selection. So i have first column as checkboxes and users selects those checkbox and as per the selection code gets the document and gives it for download to user.


                        Response.ContentType = "text/plain";
                        Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
                        Response.ClearContent();
                        Response.Buffer = true;
                        Response.Write(objBuilder.ToString());
                        Response.End();


So now i have to remove the selection after download and make those records of RADGrid with different color to indicate that record is already downloaded. how i can do that ?
Daniel
Telerik team
 answered on 07 Feb 2011
2 answers
93 views
I have a grid with image button column. On Client click I want to open window with some data from another class. The following code does that but need to click button twice. I just can not fugure out wants wrong. Please help.
.cs
if (e.CommandName == "viewQuals")
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                int id = int.Parse(dataItem["EIDColumn"].Text);
                ImageButton updateButton = dataItem["viewQualsColumn"].Controls[0] as ImageButton;
                updateButton.OnClientClick = "return viewQualsClick(" + id + ")";
               }
.aspx
function viewQualsClick(id) {
                  
                window.open("RES_MQ_new.aspx?empid=" + id, "", "width=550,height=700,resizable=yes,scrollbars=yes");
            }
 function ajaxRefresh() {
           var ram = $find("<%= RadAjaxManager.ClientID %>");
            ram.ajaxRequest("foo");
                  
            }
When I click for the first time, it goes to "<%= RadAjaxManager.ClientID %> and does nothing. And second click the window pops up with correct data.

 

 

 

Smiely
Top achievements
Rank 1
 answered on 07 Feb 2011
6 answers
352 views
Hi Telerik Team,
  This problem is related with opening a RadWindow. I have a RadGrid with a button column and need to open an Radwindow within its click event (command event). So far, this has not been a problem for me, since I had call the RadWindow mostly in
button click event of a button. (I did it like -- > RadWindow1.VisibleOnPageLoad=true ). 
But when I try to do the same thing the window is not shown (pop-up). Can you please tell me the reason? 

Note: The reason for me to open/show  the RadWindow in code behind using "RadWindow1.VisibleOnPageLoad=true" is, I need to 
to do some validations to get the decision whether to open it or do another operation. 


Thanks,
Dilip Nilanka
Smiely
Top achievements
Rank 1
 answered on 07 Feb 2011
5 answers
675 views
Hi -

I'm new to programming... so this might be a simple fix.  What I'd like to do is use a linkbutton to select a row of data, put that data into a session variable, then redirect to a page that will display the selected data.  Right now I'm trying to figure out how to use the linkbutton to select the row.
Here is my linkbutton
<telerik:GridButtonColumn ButtonType="LinkButton" Text="Select" UniqueName="ButtonColumn">  
  <HeaderStyle Width="50px" /> 
</telerik:GridButtonColumn> 
There are no onClick properties for the GridButtonColumn.  How would I initiate the event from this button?

Next, here is what I have for the behind code... once I can figure out where to put it in an event... but I know I'm missing a lot of the code...
        RadPanelItem SOISearchItem = (RadPanelItem)RadPanelBar1.FindItemByValue("SOISearch");  
        RadGrid soiRadGrid = (RadGrid)SOISearchItem.FindControl("SoiRadGrid");  
        LinkButton linkButton = (LinkButton)SOISearchItem.FindControl("LinkButton");  
          
        if (soiRadGrid.SelectedItems.Count > 0)  
        {  
          GridItem selectedItem;  
          
          // grab selected row  
        }  
 
        Session[Tip.Utility.UIConstants.SoiSession] = soi;  // soi is my class variable  
          
        Response.Redirect("SOI.aspx");  
 

Here is my Grid, which is a table of what I'm calling SOI data (I have an SOI class in the BO):
                      <telerik:RadGrid ID="SoiRadGrid" runat="server"   
                                    AllowSorting="False"   
                                    GridLines="None"   
                                    Skin="WebBlue" 
                                    AllowFilteringByColumn="False"   
                                    AllowPaging="False"   
                                    ShowGroupPanel="True">  
                      <ClientSettings Resizing-AllowColumnResize="true" AllowKeyboardNavigation="false"></ClientSettings> 
                      <MasterTableView AutoGenerateColumns="False" PageSize="5">  
                        <RowIndicatorColumn> 
                          <HeaderStyle Width="20px" /> 
                        </RowIndicatorColumn> 
                        <ExpandCollapseColumn> 
                          <HeaderStyle Width="20px" /> 
                        </ExpandCollapseColumn> 
 
                        <Columns> 
                            <telerik:GridButtonColumn ButtonType="LinkButton" Text="Select" UniqueName="ButtonColumn">  
                              <HeaderStyle Width="50px" /> 
                            </telerik:GridButtonColumn> 
                            <telerik:GridBoundColumn DataField="ID" HeaderText="ID" Visible="false"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="Tier" HeaderText="Tier"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="Org" HeaderText="Org"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="ProjectGroup" HeaderText="Project Group"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="RequestingEntity" HeaderText="Requesting Entity"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="SubmittalDate" HeaderText="Submittal Date"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="ContactInfo" HeaderText="Contact Info"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="Unredacted" HeaderText="Unredacted"></telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="Redacted" HeaderText="Redacted"></telerik:GridBoundColumn> 
                        </Columns> 
                        
                      </MasterTableView> 
                      <ClientSettings AllowDragToGroup="True">  
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
                      </ClientSettings> 
                    </telerik:RadGrid> 

I want to use the ID column, that is hidden, to grab the soi data.

What other information would be helpful to give out to solve my problem?  Did I not explain something well enough?

Also, we are using an Entity Framework, and Visual Studio 2008.

wen






M
Top achievements
Rank 1
 answered on 07 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?