I am Using Telerik rad Grid and I have Inline Add Edit and Delete Image buttons and for very first time none of the click events are firing and for the second time all events work fine. So can you suggest me any solotion for this problem
Thank You,
Rama
Thank You,
Rama
8 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 12 Sep 2011, 04:20 PM
Hello Rama,
I have tried reproducing the issue at my end but no avail. Please check the following demo which also working as expected.
Please make a double check with your code.
Grid / Automatic Operations.
Thanks,
Princy.
I have tried reproducing the issue at my end but no avail. Please check the following demo which also working as expected.
Please make a double check with your code.
Grid / Automatic Operations.
Thanks,
Princy.
0
Rama
Top achievements
Rank 1
answered on 13 Sep 2011, 03:08 PM
Hi Princy,
I double checked the code which you have provided but my case is little bit different I use WCF service and I am still facing the same problem. Do you have any clue where am I doing mistake only first click is not working from the second click every it is working fine
I double checked the code which you have provided but my case is little bit different I use WCF service and I am still facing the same problem. Do you have any clue where am I doing mistake only first click is not working from the second click every it is working fine
0
Rama
Top achievements
Rank 1
answered on 13 Sep 2011, 03:31 PM
Hi Princy,
Actually this Radgrid is a user control and placing in raddock the events are not firingg for first time
Actually this Radgrid is a user control and placing in raddock the events are not firingg for first time
0
Dan Lehmann
Top achievements
Rank 1
answered on 13 Sep 2011, 05:05 PM
Do you have the IDs set? I had a similar thing happen when I was creating controls dynamically. Events weren't firing the first time for me because I had forgotten to set the ID.
If that doesn't help, can you post the part of your code you are having trouble with?
Best wishes,
Dan
If that doesn't help, can you post the part of your code you are having trouble with?
Best wishes,
Dan
0
Rama
Top achievements
Rank 1
answered on 13 Sep 2011, 06:21 PM
Hi Dan,
This is my code can you please have a look
<
asp:Panel
runat
=
"server"
ID
=
"pnlNotes"
>
<
asp:Label
ID
=
"lblSelectSite"
runat
=
"server"
Text="<%$ Resources:Generic,NoRecord %>" Visible="false" ></
asp:Label
>
<
telerik:RadGrid
ID
=
"rgSiteNotes"
runat
=
"server"
AlternatingItemStyle-BorderColor
=
"Red"
ItemStyle-CssClass
=
"rgsiteItem"
AllowPaging
=
"true"
AllowSorting
=
"true"
AutoGenerateColumns
=
"false"
PageSize
=
"20"
>
<
MasterTableView
AutoGenerateColumns
=
"false"
ItemStyle-Height
=
"30px"
AlternatingItemStyle-Height
=
"30px"
AlternatingItemStyle-BackColor
=
"White"
CommandItemDisplay
=
"Bottom"
DataKeyNames
=
"ClientHierNoteID"
ForeColor
=
"#000"
Font-Size
=
"10px"
Font-Names
=
"Verdana,Arial"
>
<
CommandItemTemplate
>
<
div
style
=
"background-color:#bbd0e8; height:26px;"
>
<
img
src
=
"../../Assets/image/core/plus_acr.gif"
alt
=
""
/>
<
asp:LinkButton
ID
=
"LinkButton2"
runat
=
"server"
Text
=
"Add New Note"
ForeColor
=
"Black"
CommandName
=
"InitInsert"
></
asp:LinkButton
>
</
div
>
</
CommandItemTemplate
>
<
CommandItemStyle
Height
=
"30px"
CssClass
=
"rglnksiteItem"
/>
<
HeaderStyle
CssClass
=
"rgsiteHeader"
Font-Bold
=
"true"
Font-Size
=
"10px"
ForeColor
=
"Gray"
Wrap
=
"false"
Font-Names
=
"Verdana,Arial"
/>
<
FooterStyle
BackColor
=
"#91a7ba"
/>
<
ItemStyle
CssClass
=
"rgsiteItem"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ClientHierNoteID"
UniqueName
=
"ClientHierNoteID"
Visible
=
"false"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Username"
UniqueName
=
"Username"
Visible
=
"false"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
Visible
=
"false"
UniqueName
=
"site_id"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblSiteId"
><%= Request.Querystring("SiteId") %></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"ClientHierID"
UniqueName
=
"ClientHierID"
Visible
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ClientHierID"
UniqueName
=
"ClientHierID"
Visible
=
"false"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ClientHierNote"
ItemStyle-BorderColor
=
"Black"
ItemStyle-ForeColor
=
"#FF9966"
HeaderStyle-BackColor
=
"#bbd0e8"
HeaderStyle-Width
=
"240px"
UniqueName
=
"ClientHierNote"
HeaderText
=
"Note"
ColumnEditorID
=
"GridTextBoxColumnEditor3"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ClientHierNoteDate"
ItemStyle-BorderColor
=
"Black"
HeaderStyle-BackColor
=
"#bbd0e8"
HeaderStyle-Width
=
"140px"
UniqueName
=
"ClientHierNoteDate"
HeaderText="<%$ Resources:Generic,Date %>" ColumnEditorID="GridDateTimeColumnEditor"
SortExpression="ClientHierNoteDate" DataFormatString="{0:d}" ItemStyle-Wrap="false">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FirstName"
ItemStyle-ForeColor
=
"#FF9966"
ItemStyle-BorderColor
=
"Black"
HeaderStyle-BackColor
=
"#bbd0e8"
HeaderStyle-Width
=
"90px"
UniqueName
=
"FirstName"
HeaderText="<%$ Resources:Generic,Name %>" ColumnEditorID="GridTextBoxColumnEditor1" SortExpression="FirstName"
ItemStyle-Wrap="false">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
Visible
=
"false"
ItemStyle-BorderColor
=
"Black"
DataField
=
"LastName"
UniqueName
=
"LastName"
HeaderText
=
"Last Name"
ColumnEditorID
=
"GridTextBoxColumnEditor1"
SortExpression
=
"LastName"
ItemStyle-Wrap
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
ItemStyle-BorderColor
=
"Black"
CancelText
=
"Cancel"
CancelImageUrl
=
"../../Assets/image/en/btn_cancel_english.gif"
EditText
=
"Edit"
UniqueName
=
"EditCommandColumn"
UpdateText
=
"Update"
EditImageUrl
=
"../../Assets/image/core/plus-button-large.png"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
ButtonType
=
"ImageButton"
ItemStyle-BorderColor
=
"Black"
CommandName
=
"Delete"
ImageUrl
=
"../../Assets/image/core/close-button-large.png"
ConfirmDialogType
=
"Classic"
ConfirmText
=
"Delete this note?"
ConfirmTitle
=
"Delete"
Text
=
"Delete"
UniqueName
=
"DeleteColumn"
>
</
telerik:GridButtonColumn
>
</
Columns
>
<
EditItemStyle
VerticalAlign
=
"Top"
ForeColor
=
"#000"
/>
<
EditFormSettings
EditFormType
=
"Template"
>
<
FormTemplate
>
<
div
style
=
"background-color:#bbd0e8"
>
<
br
/>
<
table
id
=
"Table3"
cellspacing
=
"1"
cellpadding
=
"1"
width
=
"100%"
border
=
"0"
style="font-family: Verdana,Arial;
font-size: 10px; background-color: #bbd0e8; margin-left:5px; ">
<
tr
>
<
td
>
<
asp:TextBox
ID
=
"tbNote"
runat
=
"server"
ForeColor
=
"#FF9966"
BorderColor
=
"Gray"
Font-Size
=
"12px"
BorderStyle
=
"Solid"
BorderWidth
=
"1px"
TextMode
=
"MultiLine"
Rows
=
"6"
Text='<%# Bind( "ClientHierNote") %>'
TabIndex="4" Width="150px"></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator3"
runat
=
"server"
ControlToValidate
=
"tbNote"
ForeColor
=
"#FF0000"
Display
=
"Dynamic"
Text
=
"Note text is required."
></
asp:RequiredFieldValidator
>
</
td
>
<
td
>
<
asp:TextBox
ID
=
"tbDate"
runat
=
"server"
BorderColor
=
"Gray"
BorderStyle
=
"Solid"
Font-Size
=
"12px"
BorderWidth
=
"1px"
Text='<%# Bind( "ClientHierNoteDate","{0:d}" ) %>'
TabIndex="3" Width="110px"></
asp:TextBox
>
<
img
src
=
"~/assets/image/core/cal.png"
runat
=
"server"
id
=
"imgCal"
/>
<
cc1:CalendarExtender
runat
=
"server"
ID
=
"ceDate"
Enabled
=
"true"
PopupPosition
=
"BottomRight"
PopupButtonID
=
"imgCal"
TargetControlID
=
"tbDate"
>
</
cc1:CalendarExtender
>
</
td
>
<
td
style
=
"margin-top:0px;"
>
<
table
style
=
"margin-top:0px;"
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"firstName"
runat
=
"server"
Text
=
"FirstName:"
></
asp:Label
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:TextBox
ID
=
"tbFirst"
runat
=
"server"
BorderColor
=
"Gray"
ForeColor
=
"#FF9966"
Font-Size
=
"12px"
BorderStyle
=
"Solid"
BorderWidth
=
"1px"
Text='<%# Bind( "FirstName" ) %>' TabIndex="1"
Width="110px"></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
runat
=
"server"
ControlToValidate
=
"tbFirst"
ForeColor
=
"#FF0000"
Display
=
"Dynamic"
Text
=
"First name is required."
></
asp:RequiredFieldValidator
>
</
td
>
</
tr
>
<
tr
style
=
"margin-top:0px;"
>
<
td
>
<
br
/>
<
asp:Label
ID
=
"lastName"
runat
=
"server"
Text
=
"LastName:"
></
asp:Label
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:TextBox
ID
=
"tbLast"
runat
=
"server"
BorderColor
=
"Gray"
ForeColor
=
"#FF9966"
Font-Size
=
"12px"
BorderStyle
=
"Solid"
BorderWidth
=
"1px"
Text='<%# Bind( "LastName" ) %>' TabIndex="1"
Width="110px"></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator2"
runat
=
"server"
ControlToValidate
=
"tbFirst"
ForeColor
=
"#FF0000"
Display
=
"Dynamic"
Text
=
"First name is required."
></
asp:RequiredFieldValidator
>
</
td
>
</
tr
>
</
table
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"right"
colspan
=
"2"
style
=
"margin-top:5px; margin-left:50px;"
>
<
asp:LinkButton
ID
=
"btnUpdate"
ToolTip
=
"Save"
ForeColor
=
"Orange"
runat
=
"server"
Text='<%$ Resources:Generic,Save %>' CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' ></
asp:LinkButton
>
<
asp:LinkButton
ID
=
"btnCancel"
ForeColor
=
"Orange"
Text='<%$ Resources:Generic,Cancel %>' ToolTip="Cancel" CausesValidation="false" runat="server" CommandName="Cancel" ></
asp:LinkButton
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
FormTemplate
>
</
EditFormSettings
>
<
NoRecordsTemplate
>
<
div
id
=
"Div1"
runat
=
"server"
style
=
"margin: 25px auto; text-align: center; font-size: 11px"
>
<
strong
>
<
asp:Label
ID
=
"Label5"
runat
=
"server"
Text='<%$ Resources:Generic, NoResults %>'></
asp:Label
></
strong
>
</
div
>
</
NoRecordsTemplate
>
</
MasterTableView
>
<
ClientSettings
Selecting-AllowRowSelect
=
"true"
EnablePostBackOnRowClick
=
"true"
>
</
ClientSettings
>
</
telerik:RadGrid
>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxColumnEditor1"
runat
=
"server"
TextBoxStyle-Width
=
"125px"
/>
<
telerik:GridDateTimeColumnEditor
ID
=
"GridDateTimeColumnEditor1"
runat
=
"server"
TextBoxStyle-Width
=
"125px"
>
</
telerik:GridDateTimeColumnEditor
>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxColumnEditor3"
runat
=
"server"
TextBoxMode
=
"MultiLine"
TextBoxStyle-Height
=
"50px"
TextBoxStyle-Width
=
"365px"
/>
</
asp:Panel
>
Partial
Public
Class
SiteNotes
Inherits
BaseWidget
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
End
Sub
Protected
Overrides
Sub
RefreshContent(
ByVal
config
As
WidgetConfiguration)
If
IsBlank(config.GetKeyValue(XMLKEY_CLIENT_HIER_ID))
Then
rgSiteNotes.Visible =
False
lblSelectSite.Visible =
True
Else
Dim
strTimeLine
As
String
= config.GetKeyValue(Constants.XMLKEY_TIMELINE)
Dim
intSiteId
As
Integer
= config.GetKeyValue(Constants.XMLKEY_SITE_ID)
LoadSiteNotes(strTimeLine, intSiteId)
End
If
End
Sub
Private
Sub
LoadSiteNotes(
ByVal
strTimeLine
As
String
,
ByVal
intSiteId
As
Integer
)
Dim
strDocumentBaseURL
As
String
= ConfigurationManager.AppSettings(
"SiteServiceBaseURL"
)
Dim
channelFactory
As
New
WebChannelFactory(Of ISiteService)(
New
Uri(strDocumentBaseURL))
channelFactory.Endpoint.Behaviors.Add(
New
WebHttpBehavior)
Dim
svcProxy
As
ISiteService = channelFactory.CreateChannel()
'Dim SiteId As Integer = 273327
rgSiteNotes.DataSource = svcProxy.LoadAllSiteNote(intSiteId)
rgSiteNotes.DataBind()
rgSiteNotes.HeaderStyle.CssClass =
"rgsiteHeader"
End
Sub
Private
Sub
rgSiteNotes_DeleteCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
rgSiteNotes.DeleteCommand
Dim
strDocumentBaseURL
As
String
= ConfigurationManager.AppSettings(
"SiteServiceBaseURL"
)
Dim
channelFactory
As
New
WebChannelFactory(Of ISiteService)(
New
Uri(strDocumentBaseURL))
channelFactory.Endpoint.Behaviors.Add(
New
WebHttpBehavior)
Dim
svcProxy
As
ISiteService = channelFactory.CreateChannel()
Dim
item
As
GridDataItem =
DirectCast
(e.Item, GridDataItem)
Dim
ClientHierNoteID
As
Integer
= item.GetDataKeyValue(
"ClientHierNoteID"
).ToString()
svcProxy.DeleteSiteNote(ClientHierNoteID)
Dim
objConfig
As
New
WidgetConfiguration
objConfig = GetConfigObject()
RefreshContent(objConfig)
End
Sub
Private
Sub
rgSiteNotes_EditCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
rgSiteNotes.EditCommand
Dim
objConfig
As
New
WidgetConfiguration
objConfig = GetConfigObject()
RefreshContent(objConfig)
End
Sub
Private
Sub
rgSiteNotes_InsertCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
rgSiteNotes.InsertCommand
Dim
strDocumentBaseURL
As
String
= ConfigurationManager.AppSettings(
"SiteServiceBaseURL"
)
Dim
channelFactory
As
New
WebChannelFactory(Of ISiteService)(
New
Uri(strDocumentBaseURL))
channelFactory.Endpoint.Behaviors.Add(
New
WebHttpBehavior)
Dim
svcProxy
As
ISiteService = channelFactory.CreateChannel()
Dim
siteNote
As
New
SiteNote
Dim
item
As
GridEditableItem =
DirectCast
(e.Item, GridEditableItem)
Dim
editedItem
As
GridEditableItem =
CType
(e.Item, GridEditableItem)
Dim
newValues
As
Hashtable =
New
Hashtable
Dim
config
As
WidgetConfiguration =
New
WidgetConfiguration()
config = GetConfigObject()
siteNote.ClientHierID = config.GetKeyValue(XMLKEY_CLIENT_HIER_ID)
'267959
siteNote.FirstName =
CType
(editedItem.FindControl(
"tbFirst"
), TextBox).Text
siteNote.LastName =
CType
(editedItem.FindControl(
"tbLast"
), TextBox).Text
siteNote.Username = UserUtility.workingUser.UserName
siteNote.ClientHierNoteDate =
CType
(editedItem.FindControl(
"tbDate"
), TextBox).Text
siteNote.ClientHierNote =
CType
(editedItem.FindControl(
"tbNote"
), TextBox).Text
svcProxy.AddSiteNote(siteNote)
Dim
objConfig
As
New
WidgetConfiguration
objConfig = GetConfigObject()
RefreshContent(objConfig)
End
Sub
Private
Sub
rgSiteNotes_ItemCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
rgSiteNotes.ItemCommand
Dim
objConfig
As
New
WidgetConfiguration
objConfig = GetConfigObject()
RefreshContent(objConfig)
If
e.CommandName = RadGrid.InitInsertCommandName
Then
rgSiteNotes.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None
Else
rgSiteNotes.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Bottom
End
If
End
Sub
Public
Sub
rgSiteNotes_UpdateCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
rgSiteNotes.UpdateCommand
Dim
strDocumentBaseURL
As
String
= ConfigurationManager.AppSettings(
"SiteServiceBaseURL"
)
Dim
channelFactory
As
New
WebChannelFactory(Of ISiteService)(
New
Uri(strDocumentBaseURL))
channelFactory.Endpoint.Behaviors.Add(
New
WebHttpBehavior)
Dim
svcProxy
As
ISiteService = channelFactory.CreateChannel()
Dim
siteNote
As
New
SiteNote
Dim
item
As
GridEditableItem =
DirectCast
(e.Item, GridEditableItem)
Dim
ClientHierNoteID
As
Integer
= item.GetDataKeyValue(
"ClientHierNoteID"
).ToString()
Dim
editedItem
As
GridEditableItem =
CType
(e.Item, GridEditableItem)
siteNote.ClientHierNoteID = item.GetDataKeyValue(
"ClientHierNoteID"
).ToString()
siteNote.ClientHierNoteDate =
CType
(editedItem.FindControl(
"tbDate"
), TextBox).Text
siteNote.LastName =
CType
(editedItem.FindControl(
"tbLast"
), TextBox).Text
siteNote.FirstName =
CType
(editedItem.FindControl(
"tbFirst"
), TextBox).Text
siteNote.Username = editedItem(
"Username"
).Text
siteNote.ClientHierNote =
CType
(editedItem.FindControl(
"tbNote"
), TextBox).Text
svcProxy.UpdateSiteNote(siteNote)
Dim
objConfig
As
New
WidgetConfiguration
objConfig = GetConfigObject()
RefreshContent(objConfig)
End
Sub
End
Class
0
Rama
Top achievements
Rank 1
answered on 13 Sep 2011, 06:56 PM
Hi Dan,
When I click on any one of the Edit Delete or Add For first time none of them work and from the second time all them work finee
When I click on any one of the Edit Delete or Add For first time none of them work and from the second time all them work finee
0
Dan Lehmann
Top achievements
Rank 1
answered on 14 Sep 2011, 12:10 AM
Nothing looks wrong to me but I'm not a grid expert. I suggest reposting this in the Grid forum instead of this General forum: http://www.telerik.com/community/forums/aspnet-ajax/grid.aspx
0
Rama
Top achievements
Rank 1
answered on 14 Sep 2011, 01:35 PM
Hi Dan,
Do you think is there any problem after placing the usercontrol in to RADDOCK
Do you think is there any problem after placing the usercontrol in to RADDOCK