View Single Post
  #1 (permalink)  
Old June 25th, 2008, 10:37 AM
RaghaSM RaghaSM is offline
Registered User
 
Join Date: Jun 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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



Reply With Quote