This is a migrated thread and some comments may be shown as answers.

DataFormatString

3 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
shiva
Top achievements
Rank 1
shiva asked on 27 Jul 2010, 01:26 PM
hi,
On dataformatstring i studied from the below link
http://www.telerik.com/help/aspnet-ajax/grdnowrapforgridcellcontent.html.
i applied to gridbound column,it is working fine.while applying to gridtemplate column
it is not working.
tell me how to apply DataFormatString="<nobr>{0}</nobr>" to the gridtemplate column.
thanks..

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 Jul 2010, 02:50 PM
Hello,

Try the following approach to set formating for Label control in templatecolumn.

aspx:
<telerik:GridTemplateColumn>
    <ItemTemplate>
        <asp:Label Text='<%# Eval("ContactTitle", "<nobr>{0}</nobr>") %>' ID="Label1" runat="server"></asp:Label>
    </ItemTemplate>
</telerik:GridTemplateColumn>


Thanks,
Princy.
0
shiva
Top achievements
Rank 1
answered on 28 Jul 2010, 07:21 AM
hi,
thanks for the reply.
it is working fine.but in my application Timer1_tick event is there with interval=120000,after this interval,In timer1_tick event
we are calling "databinding"
then taskname is displaying in multi line.please suggest me how to achieve this after timer1_tick event also called..
the same is taking place when page load is happened,in page load also databinding.so it is displaying in multi line.
 
In Source:
<telerik:GridTemplateColumn HeaderText="Task Name" AllowFiltering="false" Groupable="false" HeaderStyle-Width="50px"    >
                      <ItemTemplate>
                       <asp:LinkButton ID="lnkTask" runat="server" CommandName="select" Text='<%#DataBinder.Eval(Container.DataItem,"Task Name","<nobr>{0}</nobr>")%>'></asp:LinkButton>
                       </ItemTemplate>
                       <HeaderStyle Width="70px" Font-Bold="True" Font-Italic="False"
                           Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
                           Wrap="false" />
</telerik:GridTemplateColumn>


In aspx.cs

DataBinding
{
.....
....
 LinkButton lnkbtntaskname = new LinkButton();
                        lnkbtntaskname = (LinkButton)(gviewTasks.MasterTableView.Items[i].Cells[4].FindControl("lnkTask"));
                        lnkbtntaskname.Text = gviewTasks.MasterTableView.Items[i].Cells[5].Text.ToString();
                        lnkbtntaskname.ToolTip = gviewTasks.MasterTableView.Items[i].Cells[5].Text.ToString();
...
...
}
thanks.

 
0
Mira
Telerik team
answered on 02 Aug 2010, 09:37 AM
Hello Shiva,

Please try setting the text of the link button by the following code:
lnkbtntaskname.Text = "<nobr>" + gviewTasks.MasterTableView.Items[i].Cells[5].Text.ToString() + "</nobr>";

I hope this helps.

Kind regards,
Mira
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
shiva
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
shiva
Top achievements
Rank 1
Mira
Telerik team
Share this question
or