Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
86 views
Good afternoon,
I have following code inside my radgrid:
 <telerik:GridTemplateColumn HeaderText="Job" DataField="JOB" UniqueName="JOB" ReadOnly="True" SortExpression="JOB" >
  <HeaderStyle Width="50px" />
  <ItemStyle Width="50px" />
   <ItemTemplate>
  <asp:Label ID="lblJob" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.JOB") %>'> </asp:Label>
  <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="lblJob"
   RelativeTo="Element" Position="MiddleRight" Font-Size="14" Font-Bold="true" Font-Italic="true" RenderInPageRoot="true"   Animation="Fade"  HideEvent="LeaveToolTip">
JOB EFFECTIVE DATE:
<%# DataBinder.Eval(Container, "DataItem.EFF_DATE","{0:MM/dd/yyyy}")%> <br />
JOB END DATE:
<%# DataBinder.Eval(Container, "DataItem.END_DATE","{0:MM/dd/yyyy}")%>  <br />
DATE RESTRICTION FLAG:
<%# DataBinder.Eval(Container, "DataItem.DATE_RESTRICT")%>
</telerik:RadToolTip>
</ItemTemplate>
</telerik:GridTemplateColumn>

On SelectedIndexChanged  event I try to grab value from GridTemplateColumn(JOB) like this:
RadGrid ReportGrid = (RadGrid)dataReport.FindItemByValue("ReportData").FindControl("JobReportGrid");
 JobDetail = ReportGrid.SelectedItems[0].Cells[2].Text;

And for some reason I am getting spaces.
For regular gridboundcolumn this logic works just fine.

Please help me,
Thanks so much,
Vitaly
Top achievements
Rank 1
Iron
Iron
 answered on 09 Oct 2013
1 answer
85 views

Hi,

I am using row hover for my grid.But its causing the rows to misalign. please help me with a solution.

Thanks,
Ryann.
Shinu
Top achievements
Rank 2
 answered on 09 Oct 2013
1 answer
168 views
Hi again :)

I have a radgrid that I want to filter exactly like they do in this example:

http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridcomboajax/defaultcs.aspx?product=grid


the problem though is that I am not using a sqldatasource because the items in the grid need to be editable, so I am getting the source from the code behind.

Here is how the grid is getting it's data source:

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadGrid();
        }
 
    }
 
    protected void loadGrid()
    {
        DATABASE dbcontext = new DATABASE();
        IEnumerable<LineItem> newlineitem = from p in dbcontext.LineItems
                                            select p;
        gridDataSource = newlineitem;
        RadGrid1.Rebind();
    }
 
public IEnumerable<LineItem> gridDataSource
    {
        set
        {
            Session["gridDataSource"] = value;
        }
        get
        {
            if (Session["gridDataSource"] == null)
                return null;
            else
            {
                return ((IEnumerable<LineItem>)Session["gridDataSource"]);
            }
        }
    }
 
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        RadGrid1.DataSource = gridDataSource;
    }


How can I achieve this?
Eyup
Telerik team
 answered on 09 Oct 2013
1 answer
75 views
I created a <NestedViewTemplate> inside my grid.. and i have 3 grids inside it.. and all four are connected to an object data source..
All the settings are followed by the instructions provided in link below..
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx

When the page loads.. it opens the first one as a default.. and that works fine.. but
after the postback .. none of the Tree/Hierarchy/NestedTemplate would open..

i am attaching my code with this thread..
https://docs.google.com/file/d/0B8irPIpOgH_mNVBXYlAzNHh4YU0/edit?usp=sharing


What Am i missing again?
Angel Petrov
Telerik team
 answered on 09 Oct 2013
1 answer
63 views

Hi,

How to show and hide columns by clicking on headers of the columns.

Thanks,
Erin.
Princy
Top achievements
Rank 2
 answered on 09 Oct 2013
2 answers
71 views
Hello,
I have a little problem with my page and firefox. I have in my page a radgrid that databind in client side. Multiple rows can be selected. In each row there is a link-image that open a radwindow with javasript. After the radwindow closes and some changes have been made at the data i force with javasrcipt the radgrid to rebind in order to get and show the new data.
And here is the problem
My radgrid has 100 pagesize If i click the link/image near the bottom or somewhere in the middle of the page  to open the window and the row is not selected after the rebind, in Firefox only, the page scroll up and i loose the row that i wanted to change.

If i select/check the row first and then click the link/image after the rebind the page does not scroll the same happens if i choose more than one rows. It works properly. The scroll up happens only in firefox 24.0, my latest version, in chrome works just fine.
Here is my radgrid
<telerik:RadGrid ID="dltBroadcast" EnableViewState="false" runat="server" AllowPaging="true"
                                    AllowSorting="True" PageSize="100" AllowMultiRowSelection="True" ClientSettings-EnableRowHoverStyle="True"
                                    Width="956px" CellPadding="0" CellSpacing="0" Skin="RadGridCustomBlack" EnableEmbeddedSkins="False">
                                    <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" HorizontalAlign="Justify"
                                        AlwaysVisible="True" />
                                    <MasterTableView ClientDataKeyNames="ElementId,SentimentDesc,CrawledDateTime" AllowMultiColumnSorting="true"
                                        TableLayout="Fixed">
                                        <Columns>
                                            <telerik:GridBoundColumn DataField="ElementId" HeaderText="ElementId" ReadOnly="True"
                                                UniqueName="colElementId" Visible="False">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridClientSelectColumn UniqueName="SelectColumn" DataTextField="ElementId"
                                                Resizable="false">
                                                <HeaderStyle Width="30px" />
                                            </telerik:GridClientSelectColumn>
                                            <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Left" ItemStyle-Width="25px"
                                                HeaderStyle-Width="25px" UniqueName="colSentiment" Visible="True" ItemStyle-BorderStyle="None"
                                                Resizable="false">
                                                <ItemTemplate>
                                                    <div>
                                                        <a id="linkSentimentPositive" runat="server">
                                                            <img id="ImageSentimentPositive" runat="server" width="15" height="14" border="0"
                                                                alt="" src="Images/positiveNormal.png" class="dtgridSentimentImages" /></a>
                                                        <br />
                                                        <a id="linkSentimentNeutral" runat="server">
                                                            <img id="ImageSentimentNeutral" runat="server" width="15" height="14" border="0"
                                                                alt="" src="Images/neutralNormal.png" class="dtgridSentimentImages" /></a>
                                                        <br />
                                                        <a id="linkSentimentNegative" target="_self" runat="server">
                                                            <img id="ImageSentimentNegative" runat="server" width="15" height="14" border="0"
                                                                alt="" src="Images/negativeNormal.png" class="dtgridSentimentImages" /></a>
                                                        <br />
                                                        <a id="linkSentimentUnassigned" runat="server">
                                                            <img id="ImageSentimentUnassigned" runat="server" width="15" height="14" border="0"
                                                                alt="" src="Images/unassignedNormal.png" /></a>
                                                    </div>
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridHyperLinkColumn DataTextField="Title" UniqueName="colTitle" HeaderText="Title"
                                                ItemStyle-Font-Underline="true" ItemStyle-Width="180px" HeaderStyle-Width="180px"
                                                ItemStyle-Wrap="true" SortExpression="Title">
                                                <HeaderStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Center" Wrap="False" />
                                                <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Center" BorderStyle="None" Wrap="True" />
                                            </telerik:GridHyperLinkColumn>
                                            <telerik:GridBoundColumn DataField="Snippet" HeaderText="Snippet" ItemStyle-Width="200px"
                                                HeaderStyle-Width="200px" ReadOnly="false" UniqueName="colSnippet">
                                                <HeaderStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Center" Wrap="False" />
                                                <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Left" BorderStyle="None" Wrap="True" />
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="Tags" HeaderText="Keywords" ReadOnly="True" UniqueName="colkeywords"
                                                ItemStyle-Width="70px">
                                                <HeaderStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Center" Wrap="False" />
                                                <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Center" BorderStyle="None" Wrap="True" />
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="HostNameToShow" HeaderText="Source" ReadOnly="True"
                                                UniqueName="colHostName" ItemStyle-Width="80px">
                                                <HeaderStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Center" Wrap="False" />
                                                <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Center" BorderStyle="None" Wrap="True" />
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="CrawledDateTime" HeaderText="Date" DataType="System.DateTime"
                                                ItemStyle-Width="70px" HeaderStyle-Width="70px" DataFormatString="{0:dd/MM/yyyy HH:mm}"
                                                ReadOnly="True" UniqueName="colCrawledDateTime">
                                                <HeaderStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Center" Wrap="False" />
                                                <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Center" BorderStyle="None" Wrap="True" />
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="TagName" HeaderText="User Tags" ReadOnly="True"
                                                UniqueName="colTags">
                                                <HeaderStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Center" Wrap="False" />
                                                <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                    Font-Underline="False" HorizontalAlign="Center" BorderStyle="None" Wrap="True" />
                                            </telerik:GridBoundColumn>
                                            <telerik:GridTemplateColumn UniqueName="colButtons" Visible="True" ItemStyle-Width="55px"
                                                HeaderStyle-Width="55px" ItemStyle-BorderStyle="None" Resizable="false">
                                                <ItemTemplate>
                                                    <div style="position: relative;">
                                                        <a id="linkTag" runat="server">
                                                            <img id="ImageTag" runat="server" width="13" height="13" border="0" title="Tag" alt="Tag"
                                                                src="Images/tag.gif" class="dtgridButtonsLeft" /></a> <a id="linkdelete" runat="server">
                                                                    <img id="Imgdelete" runat="server" width="13" height="13" border="0" title="Delete"
                                                                        alt="Delete" src="Images/delete.gif" class="dtgridButtonsRight" /></a><br />
                                                        <a id="linkSendEmail" runat="server">
                                                            <img id="ImgSendEmail" runat="server" width="13" height="13" border="0" title="Email"
                                                                alt="Email" src="Images/email.gif" class="dtgridButtonsLeft" /></a> <a id="LinkHighlited"
                                                                    runat="server">
                                                                    <img id="ImgHighlited" runat="server" width="12" height="12" border="0" title="Highlight"
                                                                        alt="Highlight" src="Images/highlighted.png" class="dtgridButtonsRight" /></a><br />
                                                        <a id="linkEnagagedCommunity" runat="server" style="width: 13px; height: 13px; position: absolute;
                                                            bottom: -18px; left: 0;">
                                                            <img id="ImgEnagagedCommunity" runat="server" width="13" height="13" border="0" title="Whois?"
                                                                alt="Whois?" src="Images/editUserInfo.gif" /></a><a id="LinkUrlAspect" runat="server"
                                                                    style="text-align: right; position: absolute; bottom: -16px; right: 0;">
                                                                    <img id="ImgUrlAspect" runat="server" width="10" height="10" border="0" title="Add to Community..."
                                                                        alt="Add to Community..." src="Images/addToCummunity.png" style="margin-right: 5px;" />
                                                                </a>
                                                    </div>
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                        </Columns>
                                    </MasterTableView>
                                    <ClientSettings>
                                        <ClientEvents OnCommand="dltBroadcast_Command" OnRowDataBound="dltBroadcast_RowDataBound"
                                            OnColumnClick="dltBroadcast_ColumnClick"  />
                                        <Selecting AllowRowSelect="true" />
                                        <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false"
                                            ClipCellContentOnResize="true" EnableRealTimeResize="true" AllowResizeToFit="true" />
                                        <Scrolling AllowScroll="false" UseStaticHeaders="false"></Scrolling>
                                    </ClientSettings>
                                </telerik:RadGrid>

Is there anything i can do or is something with firefox?



Iason Demiros
Top achievements
Rank 1
 answered on 09 Oct 2013
1 answer
47 views
I am removing the base row of an expanded item in edit mode (detailtable) from a RadGrid then at a later point re-adding it.  As a result the RadGrid is remembering that this item was originally expanded/editable and attempting to bind the detailtable, but does so incorrectly (I use OnDetailTableDataBind, it is not doing so).  

How do I tell the RadGrid to not preserve the expanded/editable state when the item is removed such that it does not try to re-expand when it is subsequently re-added later?
Kostadin
Telerik team
 answered on 09 Oct 2013
2 answers
68 views
When running under Firefox and the RadAsyncUpload control is disabled from the code-behind, the Select ("Browse") button is invisible until enabled. 

<telerik:RadAsyncUpload ID="ruBinaryFile" ClientIDMode="Static" runat="server" ControlObjectsVisibility="None"
                                    Width="90px"  OnClientFileUploaded="radAsyncfileUploaded" OnFileUploaded="BinaryFileUpload">
                                    <Localization Select="Browse" />
                                </telerik:RadAsyncUpload>

ruBinaryFile.Enabled = false;

Firefox version 24.
Telerik version Q2 2012
  
Hristo Valyavicharski
Telerik team
 answered on 09 Oct 2013
1 answer
131 views
Hi,

I have a RadGrid that I'm binding to a datatable, no problems there.  The datatable contains any number of columns that store a custom object which has some basic properties (text, link, etc.).

By overriding the ToString() method on the custom object, I can get the RadGrid to auto generate GridBoundColumns for each object, which is great, but what I really need is a HyperLink column, or possibly a template column that will allow me to bind to more than just the ToString() method of my objects.

So the question is, are any of the following possible?

1) Get AutoGenerateColumns to give me hyperlink columns with the appropriate properties assigned to DataTextField and DataNavigateURLField.
2) Use a template column to extract the values from the objects inside the bound data rows?
3) Create the columns dynamically in code-behind, and somehow bind the properties to the appropriate properties on my object?
4) Any other way of doing this?

I've got around a similar problem in the past by using reflection on a custom collection to expose members of a collection as properties that can be bound to a grid, but I'd really like to avoid doing something that complicated in this instance because it seems like there must be a simpler way to achiever it.  Hopefully there is and I just haven't come across it yet!

Thanks,
Mathew
Angel Petrov
Telerik team
 answered on 09 Oct 2013
1 answer
138 views
Hi Guys,

I need to open a rad window on a button click but only if the correct condition has been met.
I am trying to open my Rad Window with C# code behind by calling a javascript function.

The window i am trying to open has its own controls on it.

JS i am using to open the Rad Window
// shows the notificationForm on the new incident page.
            function showNotification() {
                  var oWnd = radopen("Notify.aspx", "Notifications", "740", "200");
            }

Rad Window which is declared on the page where i am clicking the button
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
 
        <telerik:RadWindow  ID="Notifications" runat="server" Title="Notifications" Modal="true" ShowContentDuringLoad="false" ReloadOnShow="True" ViewStateMode="Enabled"
                            VisibleStatusbar="false"  Behavior="None" Behaviors="None" VisibleTitlebar="false" >
        </telerik:RadWindow>
 
    </Windows>
</telerik:RadWindowManager>

C# code behind button click
protected void btnSave_Click(object sender, EventArgs e)
   {
       if (HasNotifications)
       {
          // Do something
       }
       else
        {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "showNotification();", true);
        }
}

it seems like the window wants to open but closes immediately.
Shinu
Top achievements
Rank 2
 answered on 09 Oct 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?