How to?
1. Create a node (Root Node) from zero.
2. Add the nodes of our existing treeview to the new node.
Example:
(rtvFrom is my radtreeview)
1 Dim node As New RadTreeNode("Root Menu")
2 node.Nodes.AddRange(rtvFrom.Nodes.Cast(Of RadTreeNode)())
3 rtvFrom.Nodes.Add(node)
4 rtvFrom.ExpandAllNodes()
Wednesday, June 23, 2010
RadTreview conected to DB example
It is very easy to work with treeviews and DB. The table structure is one of the most important things to take into consideration (It must be a table that has recursivity). Let's see a small example.
Description:
This treeview will show the available menu options for an application. Normally it varies depending on the environment:DEV(1), TEST(2), PRODUCTION(3). However, for this small example we are just sending 1 (Dev environment) hardcoded. You could use a combobox and send its value.
1) The table:
1 CREATE TABLE [dbo].[Metal_Menu](
2 [ME_SEQ] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF_Metal_Menu_ME_SEQ] DEFAULT (newid()),
3 [ME_PARENT] [uniqueidentifier] NULL,
4 [ME_DESC] [varchar](100) NULL,
5 [ME_URL] [varchar](500) NULL,
6 [ME_PAGE] [varchar](100) NULL,
7 [ME_TYPE] [int] NULL,
8 [Active] [bit] NULL CONSTRAINT [DF_Metal_Menu_Active] DEFAULT ((1)),
9 [CreatedBY] [varchar](255) NULL CONSTRAINT [DF_Metal_Menu_CreatedBY] DEFAULT ('web\iuser'),
10 [CreatedDate] [datetime] NULL CONSTRAINT [DF_Metal_Menu_CreatedDate] DEFAULT (getdate()),
11 [ModifBy] [varchar](255) NULL CONSTRAINT [DF_Metal_Menu_ModifBy] DEFAULT ('web\iuser'),
12 [ModifDate] [datetime] NULL CONSTRAINT [DF_Metal_Menu_ModifDate] DEFAULT (getdate()),
13 CONSTRAINT [PK_Metal_Menu] PRIMARY KEY CLUSTERED
14 (
15 [ME_SEQ] ASC
16 )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
17 ) ON [PRIMARY]
2. The HTML portion of the RADTREEVIEW:
1 <telerik:RadTreeView ID="rtvFrom" runat="server" EnableDragAndDrop="True" OnNodeDrop="RadTreeView1_HandleDrop"
2 OnClientNodeDropping="onNodeDropping" OnClientNodeDragging="onNodeDragging" MultipleSelect="true" EnableDragAndDropBetweenNodes="true" CheckBoxes="false">
3 <DataBindings>
4 <telerik:RadTreeNodeBinding Expanded="True" AllowDrop="false"/>
5 </DataBindings>
6 </telerik:RadTreeView>
3. The code behind (VB.Net) for this radtreeview:
1 rtvFrom.Nodes.Clear()
2 rtvFrom.DataTextField = "SYME_DESC"
3 rtvFrom.DataFieldID = "SYME_SEQ"
4 rtvFrom.DataValueField = "SYME_SEQ"
5 rtvFrom.DataFieldParentID = "SYME_PARENT"
6 ViewState.Add("TreeFrom", GetMenuTreeSync(1, strUser))
7 rtvFrom.DataSource = CType(ViewState("TreeFrom"), Data.DataSet)
8 rtvFrom.DataBind()
4. As you can see, up to his point. I am using a method "GetMenuTreeSync" to retrieve the information from the database. The method actually calls a stored procedure to get the information, but it could just execute a SQL sentence like this:
select * from ME_menu WHERE Active = 1 order by me_parent
Comments:
In this example I used a Viewstate object to store the dataset returned from the query, however you can use a simple local variable of dataset or datatable type.
Description:
This treeview will show the available menu options for an application. Normally it varies depending on the environment:DEV(1), TEST(2), PRODUCTION(3). However, for this small example we are just sending 1 (Dev environment) hardcoded. You could use a combobox and send its value.
1) The table:
1 CREATE TABLE [dbo].[Metal_Menu](
2 [ME_SEQ] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF_Metal_Menu_ME_SEQ] DEFAULT (newid()),
3 [ME_PARENT] [uniqueidentifier] NULL,
4 [ME_DESC] [varchar](100) NULL,
5 [ME_URL] [varchar](500) NULL,
6 [ME_PAGE] [varchar](100) NULL,
7 [ME_TYPE] [int] NULL,
8 [Active] [bit] NULL CONSTRAINT [DF_Metal_Menu_Active] DEFAULT ((1)),
9 [CreatedBY] [varchar](255) NULL CONSTRAINT [DF_Metal_Menu_CreatedBY] DEFAULT ('web\iuser'),
10 [CreatedDate] [datetime] NULL CONSTRAINT [DF_Metal_Menu_CreatedDate] DEFAULT (getdate()),
11 [ModifBy] [varchar](255) NULL CONSTRAINT [DF_Metal_Menu_ModifBy] DEFAULT ('web\iuser'),
12 [ModifDate] [datetime] NULL CONSTRAINT [DF_Metal_Menu_ModifDate] DEFAULT (getdate()),
13 CONSTRAINT [PK_Metal_Menu] PRIMARY KEY CLUSTERED
14 (
15 [ME_SEQ] ASC
16 )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
17 ) ON [PRIMARY]
2. The HTML portion of the RADTREEVIEW:
1 <telerik:RadTreeView ID="rtvFrom" runat="server" EnableDragAndDrop="True" OnNodeDrop="RadTreeView1_HandleDrop"
2 OnClientNodeDropping="onNodeDropping" OnClientNodeDragging="onNodeDragging" MultipleSelect="true" EnableDragAndDropBetweenNodes="true" CheckBoxes="false">
3 <DataBindings>
4 <telerik:RadTreeNodeBinding Expanded="True" AllowDrop="false"/>
5 </DataBindings>
6 </telerik:RadTreeView>
3. The code behind (VB.Net) for this radtreeview:
1 rtvFrom.Nodes.Clear()
2 rtvFrom.DataTextField = "SYME_DESC"
3 rtvFrom.DataFieldID = "SYME_SEQ"
4 rtvFrom.DataValueField = "SYME_SEQ"
5 rtvFrom.DataFieldParentID = "SYME_PARENT"
6 ViewState.Add("TreeFrom", GetMenuTreeSync(1, strUser))
7 rtvFrom.DataSource = CType(ViewState("TreeFrom"), Data.DataSet)
8 rtvFrom.DataBind()
4. As you can see, up to his point. I am using a method "GetMenuTreeSync" to retrieve the information from the database. The method actually calls a stored procedure to get the information, but it could just execute a SQL sentence like this:
select * from ME_menu WHERE Active = 1 order by me_parent
Comments:
In this example I used a Viewstate object to store the dataset returned from the query, however you can use a simple local variable of dataset or datatable type.
Monday, June 21, 2010
RadScriptManager strange error : method get_EnableCdn ...
The error:
method get_EnableCdn in type system.web.ui.scriptmanager from assembly system.web.extensions, version=3.5.0.0, culture=neutral PublicKeyToken=31bf3856ad364e35' does not have an implementation.
The solution:
1. Delete this line from the pages you have it:
1 <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
2. Verify this section in your web config:
1 <runtime>
2 <assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
3 <dependentAssembly>
4 <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
5 <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
6 </dependentAssembly>
7 <dependentAssembly>
8 <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
9 <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
10 </dependentAssembly>
11 </assemblyBinding>
12 </runtime>
Very important: Make sure you use the: appiesTo in the following line:
3. If the error message remains or in the case you were not able to see your telerik controls in design mode (you have a very big an strange error instead of it), you could also try:
- Make sure you have Telerik.Web.UI.dll, Telerik.Web.Design.dll and Telerik.Web.UI.xml in your bin folder.
4. Verify that you have only one reference to System.Web.Extensions in your project (whether you have it in your bin folder or in your GAC)
More Info:
http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/236690-error-rendering-control.aspx
http://forums.asp.net/p/1497738/3661536.aspx
method get_EnableCdn in type system.web.ui.scriptmanager from assembly system.web.extensions, version=3.5.0.0, culture=neutral PublicKeyToken=31bf3856ad364e35' does not have an implementation.
The solution:
1. Delete this line from the pages you have it:
1 <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
2. Verify this section in your web config:
1 <runtime>
2 <assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
3 <dependentAssembly>
4 <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
5 <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
6 </dependentAssembly>
7 <dependentAssembly>
8 <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
9 <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
10 </dependentAssembly>
11 </assemblyBinding>
12 </runtime>
Very important: Make sure you use the: appiesTo in the following line:
1 <assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
2
2
More Info:
http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/236690-error-rendering-control.aspx
http://forums.asp.net/p/1497738/3661536.aspx
Thursday, June 17, 2010
Is it possible to change RadDatePicker language?
Yes, It is possible. We just need to put this line of code in the Page_Load event.
1 radDateFrom.Calendar.CultureInfo = New System.Globalization.CultureInfo(strLang)
radDateFrom = your radDatePicker control.
strLang = Your Selected Language
See a Complete small example
The Client code:
1 <form id="form1" runat="server">
2 <asp:ScriptManager ID="ScriptManager1" runat="server" />
3 <div>
4 <asp:DropDownList ID="ddl1" runat="server" AutoPostBack="True">
5 <asp:ListItem Text="en-US" />
6 <asp:ListItem Text="bg-BG" />
7 <asp:ListItem Text="es-ES" />
8 </asp:DropDownList>
9 <telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server" meta:resourcekey="RadDateTimePicker1Resource1">
10 <Calendar AutoPostBack="false" RangeMinDate="01/01/2009" RangeMaxDate="12/12/2009"
11 EnableViewSelector="true" MultiViewColumns="2" MultiViewRows="2" EnableNavigation="true"
12 meta:resourcekey="RadCalendar1Resource1" />
13 </telerik:RadDateTimePicker>
14 </div>
15 </form>
The code behind:
1 Partial Class Pages_RadExample
2 Inherits System.Web.UI.Page
3
4
5 Protected Overrides Sub InitializeCulture()
6 Dim selectedLanguage As String = "en-US"
7 If Request.Form("ddl1") IsNot Nothing Then
8 selectedLanguage = Request.Form("ddl1")
9 End If
10 System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo(selectedLanguage)
11 System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo(selectedLanguage)
12 MyBase.InitializeCulture()
13 End Sub
14
15 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
16 Dim selectedLanguage As String = "en-US"
17 If Request.Form("ddl1") IsNot Nothing Then
18 selectedLanguage = Request.Form("ddl1")
19 End If
20 RadDateTimePicker1.Calendar.CultureInfo = New System.Globalization.CultureInfo(selectedLanguage)
21 End Sub
22 End Class
Wednesday, June 16, 2010
Edit button visible per row in DataGrid
This is an issue that we always need to do. However, sometimes we are not sure about where to do the coding and how.
The event:
Grid_ItemDatabound
How to - Example:
1 Protected Sub wgdLots_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles wgdLots.ItemDataBound
2 Dim txtQtyPlannedGrid As Telerik.Web.UI.RadNumericTextBox
3 Dim txtQtyPickGrid As TextBox
4 Try
5 If e.Item.ItemType = GridItemType.EditItem Then
6 txtQtyPlannedGrid = CType(e.Item.FindControl("txtQtyPlannedGrid"), Telerik.Web.UI.RadNumericTextBox)
7 txtQtyPickGrid = CType(e.Item.FindControl("txtQtyPickGrid"), TextBox)
8 If Not txtQtyPickGrid Is Nothing Then
9 strPallet = e.Item.Cells(1).Text
10 If strPallet = "" Or strPallet = " " Then
11 txtQtyPickGrid.Enabled = False
12 End If
13 End If
14 Else
15 If CDbl(txtQtyPlanned.Text) = 0 Then
16 e.Item.Cells(12).Visible = False
17 End If
18 End If
19
20 Catch ex As Exception
21 Call ManageError(strGlobalUser, strAppName, strModName, "wgdLots_ItemDataBound", intGlobalMain, Err, strGlobalPathError, ApplicationType.Web)
22 End Try
23
24 End Sub
The event:
Grid_ItemDatabound
How to - Example:
1 Protected Sub wgdLots_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles wgdLots.ItemDataBound
2 Dim txtQtyPlannedGrid As Telerik.Web.UI.RadNumericTextBox
3 Dim txtQtyPickGrid As TextBox
4 Try
5 If e.Item.ItemType = GridItemType.EditItem Then
6 txtQtyPlannedGrid = CType(e.Item.FindControl("txtQtyPlannedGrid"), Telerik.Web.UI.RadNumericTextBox)
7 txtQtyPickGrid = CType(e.Item.FindControl("txtQtyPickGrid"), TextBox)
8 If Not txtQtyPickGrid Is Nothing Then
9 strPallet = e.Item.Cells(1).Text
10 If strPallet = "" Or strPallet = " " Then
11 txtQtyPickGrid.Enabled = False
12 End If
13 End If
14 Else
15 If CDbl(txtQtyPlanned.Text) = 0 Then
16 e.Item.Cells(12).Visible = False
17 End If
18 End If
19
20 Catch ex As Exception
21 Call ManageError(strGlobalUser, strAppName, strModName, "wgdLots_ItemDataBound", intGlobalMain, Err, strGlobalPathError, ApplicationType.Web)
22 End Try
23
24 End Sub
Labels:
DataGrid,
Edit button per row,
ItemDatabound
Tuesday, June 15, 2010
RPC calls between SQL Servers
Lately, I've been trying to call an stored procedure from another server without success. The reason is that SQL Servers last versions need some additional configuration in order to make it possible.
In the previous versions of SQL Server, we just needed to add a linked server and then call the procedures. Nowadays, we need to configure the servers in order for them to allow RPC.
The error:
OLE DB provider "SQLNCLI" for linked server "[REMOVE-SERVER]" returned
message "The partner transaction manager has disabled its support for
remote/network transactions.".
Msg 7391, Level 16, State 2, Procedure [LocalStoredProc], Line 42
The operation could not be performed because OLE DB provider "SQLNCLI"
for linked server "[REMOVE-SERVER]" was unable to begin a distributed
transaction.
The solution:
1. Execute sp_addlinkedserver: More Information
2. Configure both SQL servers (the one that calls and the one that is being called)
2.1. Start the Component Services administrative tool. To do this, click Start, click Run, type dcomcnfg.exe, and then click OK.
2.2. In the console tree of the Component Services administrative tool, expand Component Services, expand Computers, right-click My Computer, and then click Properties.
2.3. Click the MSDTC tab, and then click Security Configuration.
More Information
Up to this point it worked for me. However, should you have still issues with RPC, you could always see for more configurations here
And also, If you have issues with nested transactions when using explicit transactions. Verify that: SET XACT_ABORT is ON in your session.
More Information
Just to make sure, to execute an external stored procedure from a local one. It should be called as follows:
EXEC [REMOTE-SERVER].[DB].dbo.[StoredProc]
In the previous versions of SQL Server, we just needed to add a linked server and then call the procedures. Nowadays, we need to configure the servers in order for them to allow RPC.
The error:
OLE DB provider "SQLNCLI" for linked server "[REMOVE-SERVER]" returned
message "The partner transaction manager has disabled its support for
remote/network transactions.".
Msg 7391, Level 16, State 2, Procedure [LocalStoredProc], Line 42
The operation could not be performed because OLE DB provider "SQLNCLI"
for linked server "[REMOVE-SERVER]" was unable to begin a distributed
transaction.
The solution:
1. Execute sp_addlinkedserver: More Information
2. Configure both SQL servers (the one that calls and the one that is being called)
2.1. Start the Component Services administrative tool. To do this, click Start, click Run, type dcomcnfg.exe, and then click OK.
2.2. In the console tree of the Component Services administrative tool, expand Component Services, expand Computers, right-click My Computer, and then click Properties.
2.3. Click the MSDTC tab, and then click Security Configuration.
More Information
Up to this point it worked for me. However, should you have still issues with RPC, you could always see for more configurations here
And also, If you have issues with nested transactions when using explicit transactions. Verify that: SET XACT_ABORT is ON in your session.
More Information
Just to make sure, to execute an external stored procedure from a local one. It should be called as follows:
EXEC [REMOTE-SERVER].[DB].dbo.[StoredProc]
Labels:
linked server.,
RPC calls,
SQL Server,
SQLNCLI
Monday, June 7, 2010
SQL Tips - Output within Insert - Very useful to get last UniqueIdentifier
Each time we want to get the last value inserted for an Identity or UniqueIdentifier field in our SQL table, we face a problem.
In the case of Identity fields, we can recover the last value easily using the SQL function @@identity; However, there is no SQL function to recover a uniqueidentifier field since it is not an incremental field, so what to do in such case?
It is pretty simple, the only thing we need to know is that we are able to recover any value JUST inserted into a table using OUTPUT.
Example:
1) My table definition:
1 CREATE TABLE [dbo].[Synergy_Menu](
2 [SYME_SEQ] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF_Synergy_Menu_SYME_SEQ] DEFAULT (newid()),
3 [SYME_PARENT] [uniqueidentifier] NULL,
4 [SYME_DESC] [varchar](100) NULL,
5 [SYME_POS] [int] NULL,
6 [SYME_URL] [varchar](500) NULL,
7 [SYME_PAGE] [varchar](100) NULL,
8 [SYME_TYPE] [int] NULL,
9 [Active] [bit] NULL CONSTRAINT [DF_Synergy_Menu_Active] DEFAULT ((1)),
10 [CreatedBY] [varchar](255) NULL CONSTRAINT [DF_Synergy_Menu_CreatedBY] DEFAULT ('web\user'),
11 [CreatedDate] [datetime] NULL CONSTRAINT [DF_Synergy_Menu_CreatedDate] DEFAULT (getdate()),
12 [Visible] [int] NULL CONSTRAINT [DF_Synergy_Menu_Visible] DEFAULT ((1)),
13 CONSTRAINT [PK_Synergy_Menu] PRIMARY KEY CLUSTERED
14 (
15 [SYME_SEQ] ASC
16 )
2) Getting the last inserted UniqueIdentifier value:
1 DECLARE @OutputTable TABLE (SYME_SEQ UNIQUEIDENTIFIER)
2
3 insert into dbo.synergy_menu
4 (SYME_PARENT,SYME_DESC,SYME_POS,
5 SYME_URL,SYME_PAGE,SYME_TYPE,
6 Active,CreatedBY,Visible)
7 output inserted.SYME_SEQ INTO @OutputTable
8 SELECT @TextMenuOption,SYME_DESC,
9 SYME_POS,SYME_URL,
10 SYME_PAGE,@Type,Active, @User, Visible
11 FROM dbo.synergy_menu
12 where SYME_SEQ = @MenuOption
13 and Active = 1
14
15 SELECT * from @OutputTable
3) Just try it!
In the case of Identity fields, we can recover the last value easily using the SQL function @@identity; However, there is no SQL function to recover a uniqueidentifier field since it is not an incremental field, so what to do in such case?
It is pretty simple, the only thing we need to know is that we are able to recover any value JUST inserted into a table using OUTPUT.
Example:
1) My table definition:
1 CREATE TABLE [dbo].[Synergy_Menu](
2 [SYME_SEQ] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF_Synergy_Menu_SYME_SEQ] DEFAULT (newid()),
3 [SYME_PARENT] [uniqueidentifier] NULL,
4 [SYME_DESC] [varchar](100) NULL,
5 [SYME_POS] [int] NULL,
6 [SYME_URL] [varchar](500) NULL,
7 [SYME_PAGE] [varchar](100) NULL,
8 [SYME_TYPE] [int] NULL,
9 [Active] [bit] NULL CONSTRAINT [DF_Synergy_Menu_Active] DEFAULT ((1)),
10 [CreatedBY] [varchar](255) NULL CONSTRAINT [DF_Synergy_Menu_CreatedBY] DEFAULT ('web\user'),
11 [CreatedDate] [datetime] NULL CONSTRAINT [DF_Synergy_Menu_CreatedDate] DEFAULT (getdate()),
12 [Visible] [int] NULL CONSTRAINT [DF_Synergy_Menu_Visible] DEFAULT ((1)),
13 CONSTRAINT [PK_Synergy_Menu] PRIMARY KEY CLUSTERED
14 (
15 [SYME_SEQ] ASC
16 )
2) Getting the last inserted UniqueIdentifier value:
1 DECLARE @OutputTable TABLE (SYME_SEQ UNIQUEIDENTIFIER)
2
3 insert into dbo.synergy_menu
4 (SYME_PARENT,SYME_DESC,SYME_POS,
5 SYME_URL,SYME_PAGE,SYME_TYPE,
6 Active,CreatedBY,Visible)
7 output inserted.SYME_SEQ INTO @OutputTable
8 SELECT @TextMenuOption,SYME_DESC,
9 SYME_POS,SYME_URL,
10 SYME_PAGE,@Type,Active, @User, Visible
11 FROM dbo.synergy_menu
12 where SYME_SEQ = @MenuOption
13 and Active = 1
14
15 SELECT * from @OutputTable
3) Just try it!
Thursday, June 3, 2010
Programatically changing the text of a GridButtonColum / GridEditCommandColumn / CommandItem
Task: Be able of programatically change the text of a Grid's GridButtonColum, GridEditCommandColumn and CommandItem.
Valid for: RadGrid and DataGrid
Process:
Firstly, identify the event. I've decided to use teh ItemDataBound, but it can be done using the PreRender as well.
Secondly, identify the Grid control and the columns id and types of what we need to modify.
Thirdly, do the programming in the chosen event. In this case ItemDatabound:
Finally, The code is ready to test.
Valid for: RadGrid and DataGrid
Process:
Firstly, identify the event. I've decided to use teh ItemDataBound, but it can be done using the PreRender as well.
Secondly, identify the Grid control and the columns id and types of what we need to modify.
Thirdly, do the programming in the chosen event. In this case ItemDatabound:
1 If (TypeOf e.Item Is GridHeaderItem) Then
2 Dim columnView As GridButtonColumn = CType(e.Item.OwnerTableView.GetColumn("View"), GridButtonColumn)
3 columnView.Text = GetCommonMessage(strGlobalUser, "View", strLang)
4 Dim columnEdit As GridEditCommandColumn = CType(e.Item.OwnerTableView.GetColumn("EditCommandColumn"), GridEditCommandColumn)
5 columnEdit.EditText = GetCommonMessage(strGlobalUser, "Edit", strLang)
6 End If
7
8
9 If e.Item.ItemType = GridItemType.CommandItem Then
10 CType(e.Item.FindControl("lblAddProduct"), Label).Text = GetCommonMessage(strGlobalUser, "AddNewLine", strLang)
11 CType(e.Item.FindControl("lnkAddProduct"), LinkButton).ToolTip = GetCommonMessage(strGlobalUser, "ClickHereToAddaNewLine", strLang)
12 End If
2 Dim columnView As GridButtonColumn = CType(e.Item.OwnerTableView.GetColumn("View"), GridButtonColumn)
3 columnView.Text = GetCommonMessage(strGlobalUser, "View", strLang)
4 Dim columnEdit As GridEditCommandColumn = CType(e.Item.OwnerTableView.GetColumn("EditCommandColumn"), GridEditCommandColumn)
5 columnEdit.EditText = GetCommonMessage(strGlobalUser, "Edit", strLang)
6 End If
7
8
9 If e.Item.ItemType = GridItemType.CommandItem Then
10 CType(e.Item.FindControl("lblAddProduct"), Label).Text = GetCommonMessage(strGlobalUser, "AddNewLine", strLang)
11 CType(e.Item.FindControl("lnkAddProduct"), LinkButton).ToolTip = GetCommonMessage(strGlobalUser, "ClickHereToAddaNewLine", strLang)
12 End If
Finally, The code is ready to test.
Labels:
CommandItem,
GridButtonColum,
GridEditCommandColumn,
RadGrid
Subscribe to:
Posts (Atom)