Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Asp.net GridView control CommandField EditText/DeleteText

Posted on 2009-04-07
3
Medium Priority
?
1,481 Views
Last Modified: 2012-05-06
I have a GridView contol with rows which can be edited and deleted.
Using Edit Field command I can set EditText and DeleteText for a CommanField. But how to change these values at run time in VB code? I need this for translations to other languages.
0
Comment
Question by:IpZero
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Accepted Solution

by:
burakiewicz earned 2000 total points
ID: 24090820
i think you need to do this after the databind but not 100% sure
replace the 0 with the position of your command column and the name of your gridview for gridview1
Dim cf As CommandField = CType(GridView1.Columns(0), CommandField)
cf.EditText = ""
0
 
LVL 8

Expert Comment

by:ppittle
ID: 24092748
lpZero,

You have a few options to accomplish this.  You can convert the CommandField into a TemplateField, which will give you the following markup:

<asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                        Text="Edit"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>

You can than add an event handler on the LinkButton PreRender event to modify the Text, or you can hook into the GridView's DataBound event and use the code burakiewicz recommended.  Or you can set it declaritively using the <%$ %> syntax.  The following MSDN article dicuss how to use this declarative syntax for Localization on ASP.NET controls: http://msdn.microsoft.com/en-us/library/fw69ke6f(VS.80).aspx when you a series of Culture specific Resource files.
0
 

Author Closing Comment

by:IpZero
ID: 31567679
It worked fine in Page_Load event. :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question