p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Basics (http://p2p.wrox.com/forumdisplay.php?f=136)
-   -   Link button in nested grids clcik doesnt work fir (http://p2p.wrox.com/showthread.php?t=69010)

RaghaSM June 25th, 2008 10:37 AM

Link button in nested grids clcik doesnt work fir
 
Hi all,

I have a Nested grids ( datagrid inisde a gridview ). I placed a Link Button inisde teh datagrid and specified the command argumnet and command name.

Based on the command name I want to open a popup window.

This doesnt work for the first time , but works when i click on teh second time.

Heres my code... Please help:

<asp:TemplateColumn>

<ItemTemplate>

<asp:LinkButton ID="lnkbtnAgency" runat="server" Text='<%# Bind("AgencyName") %>' CommandName="Agency" CommandArgument='<%#Bind("AgencyId") %>'></asp:LinkButton>



</ItemTemplate>

<HeaderStyle HorizontalAlign="Center" Width="162px" />

<ItemStyle BackColor="#BEDAFE" HorizontalAlign="Center" />

</asp:TemplateColumn>

Private Sub dgchild_Itemcommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs )
If (e.CommandName = "Agency") Then

Dim rindex As Integer = DirectCast(DirectCast(source, DataGrid).Parent.Parent, GridViewRow).RowIndex
Session("StartDate") = CType(gvParent.Rows(rindex).FindControl("LabelStar tdate"), Label).Text

Session("Enddate") = CType(gvParent.Rows(rindex).FindControl("LabelEndd ate"), Label).Text
Dim agencyid As Integer = e.CommandArgument

Dim lnkAgency As LinkButton = CType(e.Item.FindControl("lnkbtnAgency"), LinkButton)
lnkAgency.OnClientClick = "javascript:openPopup('Agency_TrainingDetails.aspx ?Agency_id=" + agencyid.ToString + "');"

End If

End Sub



And I raised a event for the child datagrid Item command in the parent ridview then in that i have written this code:

I traced and seems to working fine.. but dont understnd why its not working for the first time.

Can some body let me know , where I am going????

Your help is very much appreciated




pons_saravanan June 26th, 2008 12:05 AM

can you please check the view source of the rendered page on first click and check javascript:openPopup('Agency_TrainingDetails.aspx? Agency_id=" + agencyid.ToString + "');" is rendered or not

based on my understanding from your query. i would suggest you to add the client click method in rowDataBound

Pon Saravanan
http://www.vbknowledgebase.com/WebAp...ew-walkthrough


All times are GMT -4. The time now is 06:46 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.