Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    ASP.NET


Advertisements:










C# - Truncate Text In RadGrid Column?


using Telerik RadGrid* in a LINQ context, with ASP.NET/C#, how to truncate text to a maximum length when displaying in columns? By maximum, I mean if original string's length is shorter than the specified maximum length, no errors will raise.I have seen many examples of this on the net, but it seems that the Container.DataItem used to achieve this is different when using LINQ. Sometimes we see DataItem as a method, sometimes not. Examples are usually using a DataSet.Here's an example found (source) :

<asp:TemplateField HeaderText="Description">
<ItemTemplate>
<%# ValidateString(Container.DataItem("Description")) %>

[code]...


View 2 Replies (Posted: Jan 19 10 at 15:21)

Sponsored Links:

Related Forum Messages For ASP.NET category:
C# - RadGrid Column Editable On Insert But Set To Readonly On Update?
I have a RadGrid which has a column like:

<telerik:GridTemplateColumn HeaderText="Car" >
<ItemTemplate>
<asp:Label ID="MakeLabel" runat="Server" Text='<%# Eval("Make") %> />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="MakeTextBox" runat="Server" Text='<%# Bind("Make") %> />
</EditItemTemplate>
</telerik:GridTemplateColumn >

and I'm wanting to set it up so that this column will allow input when inserting new values but won't when updating values.

Posted: Nov 6 10 at 1:56

View 2 Replies!   View Related
C# - Extra Column Appearing When Paging In Telerik RadGrid?
I'm getting a blank column when switching to another page using the default pager in the telerik radgrid. As data for each row, it shows the type of data i am using for the rows (SearchRecord)

Anyone have any clues as to why this may be happening? It doesn't show up on initial population of the grid, but only when I do paging. My columns are built dynamically but i confirmed that when my columns are built, they are the correct number.

Posted: Oct 5 10 at 13:19

View 1 Replies!   View Related
Column In DataView Not Rendering When Databound To DataGrid (or RadGrid)?
Using ASP.NET Web Forms.I am databinding a DataView to a DataGrid with AutoGenerateColumns set to trueThe final column of the DataView is not rendering.Using the debugger I can see that the column definitely exists in the data grid's datasource. The column is of type decimal and some of the rows in the column have data in them.The column has a column name.The other columns are rendering fine.What's going on?Some more infoFunnily enough, I can set AutoGenerateColumns to false, then just add the columns manually:

datagrid.Columns.Clear();
foreach(DataColumn column in dataView.Table.Columns)
{
datagrid.Columns.Add(new BoundColumn {
HeaderText = column.ColumnName });
}
datagrid.DataSource = dataView;

This works fine. Why can't .NET do this with AutoGenerateColumns?

Posted: Sep 7 10 at 6:51

View 1 Replies!   View Related
Best Practice To Manage Telerik RadGrid Grid And Column Widths?
I wanted to ask what is the best practice to manage width of the radGrid.

For my application most users are running 1280 x 1024 so I would be happy to set my overall grid width to 1100. However, depending on the form in use, I sometimes have horizantal scroll bars. To solve this, I have been playing with the width of the grid, and also I have played with setting the itemstyle-width for one or two columns. Sometimes I accidentally get it right, and sometimes it is not quite right.

What is the best way to manage this? Do I set the grid, and then all columns, or just the grid, or just the columns? I guess there is a best practice, so just wondering how you handle it,

Posted: May 25 10 at 10:12

View 2 Replies!   View Related
Using Telerik RadGrid - How To Set The Date Format For Autogenerated Column In Edit Mode
Using VS2008, and Telerik radGrid version 2010.1.519.35

I have a about 50 DNN modules using telerik radgrid and I need to display my dates in dd/mm/yy format. It is possible to do this easily in view mode, but when I switch to edit mode, it is more of a struggle. I can write a snippit of code to reformat the displayed date values to dd/mm/yy, but for inserts the user must enter mm/dd/yy.

IOW, I need to change the culture of the form to en-GB culture.

In my DotnetNuke App, I have made a change to the web.config, but it still assumes en-US format.

I am not sure whether I need to set this at web.config level, page level or at the column within the control.

Posted: May 23 10 at 11:54

View 3 Replies!   View Related
Forms Data Controls :: Showing Image In One Column In Radgrid Using Values From Database?
I am having one column in each row of my radgrid in which i want to show an image. I am getting values from database saying 1,2 for that particular column and for each of these values i want to show different images for different values. For Example if i am getting 1 from database i want to show "roseImage" and for 2 i want to show "lotusimage",

Posted: Jan 19, 2010 07:48 AM

View 3 Replies!   View Related
Forms Data Controls :: Display Text In 2 Rows And Then A Gridview Column - Third Row Is Displayed As A Row Under First Column
I havea gridview with 3 columns. In second column I want to display some text in 2 rows and then a gridview.
Here is my code:

[Code]....

The problem is my third row is displayed as a row under first column. How do I make it a separate column in my girdview. Not sure what is going wrong.

Posted: Jul 14, 2010 04:33 PM

View 11 Replies!   View Related
SQL Server :: Truncate URL While Displaying Data?
I have a column([URL])in my Table ([Titles])it has url's with different lengths, I want to display the URL (only till start of the query string ) in Gridview from this column

Eg: www.asp.net?thisis%test.cid -- is the original one in DB and i want output to be like

www.asp.net ( only till the ?). I know how to do this via C# code but I am drawing blank on how to do this in a query or Stored Proc.

it has url's with different lengths, I want to display the URL (only till start of the query string ) in Gridview from this column

Posted: Dec 03, 2010 12:06 AM

View 8 Replies!   View Related
Web Forms :: Set Text Box Height According To (table Column) Text
I have a multiline text box on page which has style "overflow: hidden" to hide the scroll bar. I want to set the vertical hight of that text box at runtime according to the string coming from table column. Is there any way of doing it? I have tried to put the text in array but its not working....

Dim myParas As Object
myParas = Split(TextBox2.Text, vbNewLine)
ln = UBound(myParas) + 1
TextBox2.Height = 22 * ln

Posted: Jul 02, 2010 11:37 AM

View 4 Replies!   View Related
Web Forms :: Attempting To Truncate Fields In A GridView?
I have been trying to figure this out and can't... I have seen this code used before but for some reason it will not work in this situation. I have a GridView and I want to truncate cells where the field length is greater than 18 characters and then show the entire contents in a tool tip. The tool tip works fine but I can't get the field contents to truncate. When I run in debugger the tc.text always shows as . but when the page renders there is content in these cells, content over 18 characters. The code never errors out it just never sees the contents as anything but "" and therefore never truncates the field contents.

[Code]....

Posted: Jan 25, 2010 06:17 PM

View 5 Replies!   View Related
DataSource Controls :: How To Truncate The Table Which Have Foreign Key
In my database I have more than 10 tables and some of the tables have foreign key relations, I want to truncate all my tables including the table which have foreign key I tried to truncate like

truncate table InventorySalesquotationMaster

It shows error

Cannot truncate table 'InventorySalesquotationMaster' because it is being referenced by a FOREIGN KEY constraint.how can I truncate the table which have foreign key

Posted: Jul 02, 2008 06:54 AM

View 10 Replies!   View Related
Mobiles :: To Truncate Existing Website For Use With Devices
I would like to truncate my existing website for use with mobile devices specifically the iphone. how might I accomplish this? Are there MS tools or methodolgies for truncating my site without building a new website from scratch?

Posted: Feb 07, 2010 06:19 PM

View 2 Replies!   View Related
DataSource Controls :: Use Transaction To Work With Truncate And Sqlbulkcopy?
I code to exec a store procedre (sp_truncate) to truncate 10tables and using sqlBulkCopy to download a huge data. Both them are working fine.Now I want to use transaction withapplication (not in store procedure) torollback truncate tables if download is failed.Is it possible to use transaction to work with these two steps?

Posted: Apr 30, 2010 02:32 PM

View 1 Replies!   View Related
DataSource Controls :: How To Truncate A String In A Database Table
I get an error when I try to update a row in an SQL database table with a string of fewer characters than were previously stored. I attempted to correct this problem by using the "PadRight" function in my C# webpage event handler to fill in the remaining characters with spaces, but I don't seem to be able to make that work. So, what do I do when I want to store fewer characters in a table row that has more characters previously stored in it?

Posted: Jun 14, 2010 12:11 AM

View 2 Replies!   View Related
DataSource Controls :: Deleting Top 500 Rows With Truncate Statement?
I have table with 1000 rows. is it possible to delete top 500 rows with truncate statement ??

Posted: Jun 01, 2010 07:39 AM

View 2 Replies!   View Related
SQL Reporting :: Wrap Text In A Column Text Box
I am having a table in rdlc that displays the data from a dataset. My problem is the value of one of the fields is long contineous string because of which my report is getting expanded horizontally. i want to wrap the text in this fieldso that it occupies fixed width of column & gets wrapped.I cant manipulate the text as i have to export the report to PDF.

Posted: Jul 13, 2010 12:04 PM

View 3 Replies!   View Related
Crystal Reports :: Ho To Get 3 Decimal Digit From A Float Value Using Truncate Function
I want to display a number to words. for eg : RO 70.357 should display as "Seventy Rials and three hundred fifty seven baiza" because in Oman currency is of 3 decimal digits.

My question is below

When I used truncate function to get the decimal value it returning with 2 decimal digits. eg: 70.36 (357 is rounded to 36)

I want to display exact digits without rounding a decimal value.

Posted: Mar 01, 2011 06:49 AM

View 1 Replies!   View Related
SQL Server :: Truncate, Find The Last Space, Remove Any Characters After That Space, Then Add Some Full Stopseg?
i'm writing a stored proc and if a field i return is longer then 200 characters, i want to truncate, find the last space, remove any characters after that space, then add some full stopseg:

INSERT INTO @rec(articleid, abstract)
SELECT a.id,
CASE

[code]...

Posted: Feb 10, 2011 12:34 AM

View 4 Replies!   View Related
GridView Column Value In Label.Text
I have an objectDataSource that is bound to an XML file in which data is inserted through a DetailsView. Now each time I insert data a GridView shows the update. In the XML datasource I have an Item called First_Name. With each Page_Load I want like this: Label1.Text = "Many Thanks " + GridView1.Column[2].ToString();//this code should be written properly which I failed to do.

Posted: Dec 21 09

View 3 Replies!   View Related
Show A Text Value In A Column In Gridview In .net?
I have a GridView to show user detail like name,phone,and status(active,suspend).my problem is that in database the user status in from of integer like 1 for Active and 0 for suspend.now while i am showing data to user in GridView I want to show Active and suspend Text according to status in database 1 or 0. I am not getting where to check for this condition in Asp.Net I am new in asp. I have done it in php also.like

if($fetch->user_status==1)
echo "Active"
else
echo "suspend"

Posted: Jan 29 at 8:11

View 2 Replies!   View Related
C# - Wrap Text In Boundfield Column In Gridview
i am having a boundfield column and in that column if i entered a string(without spaces) of length 15, there is no problem. But if the string is more than 15, the text is not wrapped. I gave the command column.ItemStyle.Wrap=true; But its not working. I have fixed the width of the column. How to wrap the text in the boundfield if a string more 15 characters.

Posted: Oct 27 10 at 4:02

View 3 Replies!   View Related
ADO.NET :: SQL Column Values To Display In Text Boxes
I am hoping this is not a silly question but I have been struggling to find an answer. I have created a web application to insert data into SQL database using T_SQL and stored procedures as I needed to update several tables at the same time. The design of a particular page is using text boxes and dropdown list's and not the default gridviews or details view as I wanted the page structure set out in a particular way. Anyways I now want to create an update page which I will get redirected to from a search page.My question is how do I assign the column values to text boxes or Dropdown lists from my Select statement. I was thinking of having a event in the page load method. Sort of like this 'Select InvoiceID, Invoicetype, Notes FROM TblInvoice Where Invoicenumber = @Invoicenumber " the parameter value @Invoicenumber will be assigned via the search page so I will also need to pull that in on the page load event. So my page would look something like this if say the:-

Textbox1 = InvoiceID(Value)
DropDownnlist1 = Invoicetype(Value)
Textbox2 = Notes(Value)

how to write this in a code behind page. I would then click a button to update the values if I changed them and write my update statement for the button click event which I know how to do .

Posted: Aug 13, 2010 02:53 PM

View 3 Replies!   View Related
Fill Text Box With Column Value GridView Selection C#?
I have a search box that will populate a data grid with LIKE values. For example we have product codes abc1q, abc1g, abc1c, and I am typing in abc to get a list of all. What I would like to do is be able to use that text box to search, but then be able to select a value from the GridView results and take the value of the ProductCode column and replace the abc used to search with the chosen product code.

In short if I type in abc, hit search and select abc1g from the DataGrid, I want abc1g to replace abc in the text box.

Posted: Sep 22, 2009 08:54 PM

View 8 Replies!   View Related
DataSource Controls :: Split Text Column On Delimiter?
I have a column with a random length of text, basically it's an old crappy mfg system that stores data in a tilde delimited list. I need to output this column into each seperate column for a view. Column names don't matter, they can all be unnamed but so long as the data returns as seperate columns is what I'm after.

[Code]....

Posted: Jan 29, 2010 06:45 PM

View 2 Replies!   View Related
Web Forms :: How To Display The Column Of The Row Selected To Appear In The Text Boxes
Im trying to use datarow to allow me to traverse through rows. how to display the column of the row selected to appear in the text boxes.

Private Sub NavigationButtons_Click(ByVal senders As Object, ByVal e As System.EventArgs) Handles FirstButton.Click, _

Posted: Oct 27, 2010 07:25 PM

View 3 Replies!   View Related
C# - Dynamically Changing Header Text Of A Gridview Column?
iam using ASP gridview. And i declare one label in headertemplate for setting heading of a particular column. How can i dynamicallly change the header text on a particular button click..

Posted: Feb 1 at 8:49

View 2 Replies!   View Related
C# - Allow Some Specific Character From Long Text In Telerik Column?
I have an aplication in asp.net MVC and using telerik grid for displaying the record. Now one of my field has some large text about 1000 character due to which the text is getting extended vertically and layout is not looking good.

Is there any way to show some specific number of character in the column and show the whole text in a tool tip on mouse hover or any other way to show the complete text for that column.

Posted: Jul 20 10 at 4:34

View 2 Replies!   View Related
C# - Add A RadGrid To A NestedViewTemplate?
I am currently using Visual Studio 2008 to develop a hierarchical grid that displays records, its got 3 levels. The code looks roughly like this.

<telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0" RenderSelectedPageOnly="false">
<telerik:RadPageView ID="RadPageView1" runat="server">
<telerik:RadGrid ID="radGrd1">
<MasterTableView>

[Code]....

I have ommited all the code and just provided the skeleton.

The problem i am having is that when i add the Radgrid, the intellisense does not seem to pick it up and visual studio does not add it to the designer class either.

I have tried viewing it in design view and forcing it to sync and even manually added it to the designer class myself. These solutions have not solved my problem as although the intellisense does pick up the control after adding it manually, the control itself is set to null during run time.

So basically is it possible to add a rad grid in the first place and if so what am i doing wrong.

Posted: Nov 17 10 at 14:10

View 1 Replies!   View Related
Values Appearing As Null - How To Access The Column's Text Property
I have the following GridView - this is the columns section:

[Code]....

And within my code behind, I'm trying to access the column's text property, I'm trying to debug it, so my code looks something like this:

[Code]....

Only Cells[0] returns me the text, the rest gets me "".

Posted: Dec 25, 2008 03:28 AM

View 7 Replies!   View Related
Forms Data Controls :: GridView Sorting Text On Column
I am trying to change the text in the header column when the GridView is sorted by checking the SortedDirection of the GridView.

problem:The text in the header column gets changed after i have clicked three times to sort the GridView.

i don't understand my problem. it seems really simple to get it work...this is what i done on each databound

[Code]....

Posted: Feb 21, 2011 07:09 AM

View 15 Replies!   View Related
Forms Data Controls :: GridView - How To Add Text To A Column After Databind
I have a gridview which is populated by SQL command at page load. Here is the sample below;

[Code]....

Posted: Dec 28, 2010 07:13 AM

View 3 Replies!   View Related
Forms Data Controls :: How To Find Text In A Gridview Column
I would like to enter a name into a textbox, click a button and find the name inmy gridview name column , then move to and select that row in the gridview. How can this be done?

Posted: Feb 23, 2011 05:49 PM

View 4 Replies!   View Related
Forms Data Controls :: How To Get Datagrid Header Column Text
Is there any way to get thedatagridheader column's text before the grid loads.

Posted: Jan 20, 2011 11:07 AM

View 7 Replies!   View Related
Forms Data Controls :: Templated Column Gives Empty Text
I have a GridView andthe second column (ie column 1)is:

[Code]....

On the GridView's SelectedIndexChanged event I have:

[Code]....

fullname is a Label alright, but its Text property is an empty string. How do I get the actual string that is shown in the cell?

Posted: Jul 14, 2010 07:29 AM

View 9 Replies!   View Related
Forms Data Controls :: Gridview Contain An Image And Text In The Same Column?
I have a 1-column gridview(and it must remain 1-column) which contains only text. My requirement is to prefix each row with an image followed by the text. The image may or may notbe indented a bit, like an expanded child node in atree.

I know a gridview renders as a table and I know I could put an image at the beginning of each row in a table (using a repeater, for example).But this is an existing app with a couple gridviews which need to be enhanced and I don't have the time to swap out the gridviews for repeaters.

Posted: Oct 05, 2010 07:03 PM

View 2 Replies!   View Related
Forms Data Controls :: Make Text Fit Into Column Of A Gridview?
i'm bindng data to gridview using bound field.one column of gridview is linkbutton.if the text is more than the cell width then the gridview width is increasing automatically.for ex if i have text like "microsoft asp.net forums" then it's displaying the whole text.but i need that text like "microsoft.....".how to display like this in gridview?

Posted: Oct 04, 2010 10:02 AM

View 5 Replies!   View Related
Forms Data Controls :: Wrap The Text In The Column Of The GridView?
I want to wrap the text in the column of the GridView. How can i do this?

I tried setting, <ItemStyle wrap = "true">but it didn't work for me?

Posted: Mar 23, 2010 12:49 PM

View 2 Replies!   View Related
Alternative To Telerik RadGrid?
Is anyone able to offer any decent alternatives to the telerik ASP.Net controls.

I'm in the market for a decent grid control with all singing all dancing extensions... bt I'm finding the telerik grid really hard work to deal with.

The telerik controls do look good, but after a day of hard work with them I'm just looking to see if there are any other 3rd party offerings?

Posted: Jan 14 at 15:46

View 3 Replies!   View Related
Telerik RadGrid - How To Add A New Row From Code Behind
What's the simplest way to add a new row to a Telerik RadGrid in ASP.NET from code behind?

Posted: Feb 5 10 at 17:50

View 2 Replies!   View Related
Copyright 2005-08 www.BigResource.com, All rights reserved