Click here to Skip to main content
15,912,756 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionSetting Css value from code behind Pin
nainakarri17-Jul-09 3:19
nainakarri17-Jul-09 3:19 
AnswerRe: Setting Css value from code behind Pin
Aman Bhullar17-Jul-09 3:40
Aman Bhullar17-Jul-09 3:40 
GeneralRe: Setting Css value from code behind Pin
Abhijit Jana17-Jul-09 3:54
professionalAbhijit Jana17-Jul-09 3:54 
QuestionHow I can get Selected Node in treeview Pin
Qasim198417-Jul-09 3:05
professionalQasim198417-Jul-09 3:05 
QuestionSet the Max character length in Grid column Pin
vid nandha17-Jul-09 2:48
vid nandha17-Jul-09 2:48 
AnswerRe: Set the Max character length in Grid column Pin
Qasim198417-Jul-09 3:07
professionalQasim198417-Jul-09 3:07 
GeneralRe: Set the Max character length in Grid column Pin
vid nandha17-Jul-09 3:17
vid nandha17-Jul-09 3:17 
GeneralRe: Set the Max character length in Grid column Pin
Qasim198417-Jul-09 3:44
professionalQasim198417-Jul-09 3:44 
use the itemtemplate instead of BoundField
like this one

<Columns>
<asp:BoundField HeaderText="Name" DataField="Name" ItemStyle-Width="30%" />
<asp:TemplateField >
<ItemTemplate>
<asp:Label id="lblDescription" Text='<%# Eval("Description") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField Text="Edit" DataNavigateUrlFormatString="/Menu/MenuCategory.aspx?Restaurant&MenuCategoryID={0}"
DataNavigateUrlFields="MenuCategoryID" HeaderText="Edit"></asp:HyperLinkField>
</Columns>

Then use the RowDataBound event of your gridview

and code the following
protected void gvMenuCategory_RowDataBound(object sender, GridViewRowEventArgs e)
{
string fulldesc="";
if(e.Row.RowType==DataControlRowType.DataRow)
{
DataRowView dr= (DataRowView)e.Row.DataItem;
fulldesc=dr["Description"].ToString();


Label lbldesc = (Label)e.Row.FindControl("lblDescription");
lbldesc.Text = fulldesc.Substring(0, 19);

}
}

Hope this work for you
GeneralRe: Set the Max character length in Grid column Pin
vid nandha17-Jul-09 18:51
vid nandha17-Jul-09 18:51 
GeneralRe: Set the Max character length in Grid column Pin
Qasim198417-Jul-09 21:05
professionalQasim198417-Jul-09 21:05 
GeneralRe: Set the Max character length in Grid column Pin
vid nandha18-Jul-09 0:29
vid nandha18-Jul-09 0:29 
GeneralRe: Set the Max character length in Grid column Pin
vid nandha18-Jul-09 0:34
vid nandha18-Jul-09 0:34 
GeneralRe: Set the Max character length in Grid column Pin
vid nandha18-Jul-09 0:54
vid nandha18-Jul-09 0:54 
QuestionMasterPage!! Pin
Sr...Frank17-Jul-09 2:26
Sr...Frank17-Jul-09 2:26 
AnswerRe: MasterPage!! Pin
Manas Bhardwaj17-Jul-09 2:40
professionalManas Bhardwaj17-Jul-09 2:40 
AnswerRe: MasterPage!! Pin
Abhijit Jana17-Jul-09 3:11
professionalAbhijit Jana17-Jul-09 3:11 
GeneralRe: MasterPage!! Pin
Sr...Frank17-Jul-09 4:22
Sr...Frank17-Jul-09 4:22 
QuestionNo image is displayed at run-time in the page in image control Pin
Chesnokov Yuriy17-Jul-09 1:53
professionalChesnokov Yuriy17-Jul-09 1:53 
AnswerRe: No image is displayed at run-time in the page in image control Pin
Abhijit Jana17-Jul-09 2:10
professionalAbhijit Jana17-Jul-09 2:10 
GeneralRe: No image is displayed at run-time in the page in image control Pin
Chesnokov Yuriy17-Jul-09 2:18
professionalChesnokov Yuriy17-Jul-09 2:18 
GeneralRe: No image is displayed at run-time in the page in image control Pin
Manas Bhardwaj17-Jul-09 2:26
professionalManas Bhardwaj17-Jul-09 2:26 
AnswerRe: No image is displayed at run-time in the page in image control Pin
Chesnokov Yuriy17-Jul-09 2:43
professionalChesnokov Yuriy17-Jul-09 2:43 
GeneralRe: No image is displayed at run-time in the page in image control Pin
Abhijit Jana17-Jul-09 2:47
professionalAbhijit Jana17-Jul-09 2:47 
AnswerRe: No image is displayed at run-time in the page in image control Pin
Abhijit Jana17-Jul-09 2:39
professionalAbhijit Jana17-Jul-09 2:39 
GeneralRe: No image is displayed at run-time in the page in image control Pin
Chesnokov Yuriy17-Jul-09 2:44
professionalChesnokov Yuriy17-Jul-09 2:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.