Gridview Row Selection in ModalPopupExtender [Using VB]

Hello EE!

I need some assistance in implementing the correct script for a gridview control that is displayed using the ModalPopupExtender control. Currently I have a panel that has a gridview control (gv1) and I'm trying to "select" a row and get the datakey for that given row. I've added a RowCommand event to my code behind and using e.CommandArguement.ToString() to get my row value which does work. However, my real concern is a flicker that takes place when I select the row... how can I eliminate this? I want to keep my modal window open without a flicker.

Any guidance or suggestions will be greatly appreciated.
Protected Sub gv1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gv1.RowCommand

        If e.CommandName = "Select" Then

            ModalPopupExtender1.Show()

            Dim empID As Integer = e.CommandArgument.ToString()
            Label1.Text = empID.ToString

        End If


    End Sub


=====
.aspx
=====

        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:Panel ID="PanelOutter" runat="server" CssClass="modalBoxImg" Style="display: none;">
        <div class="modalInner">
        <div class="modalTitle">
        I am ...
        </div>
        <asp:GridView ID="gv1" runat="server" DataKeyNames="EMP_ID" OnRowCommand="gv1_RowCommand">
        <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:LinkButton ID="selectEmp" runat="server" CommandArgument='<%# Eval("EMP_ID") %>' CommandName="Select">View Details</asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
        </Columns>
        </asp:GridView>
        <asp:Button ID="Process" runat="server" Text="This is me" />
        <asp:Button ID="Cancel" runat="server" Text="Cancel" />
        <asp:Label ID="Label1" runat="server" />
        </div>
        </asp:Panel>
        <asp:Button ID="ShowBtn" runat="server" Text="Button" Style="display: none;" />
        <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="ShowBtn" CancelControlID="Cancel" PopupControlID="PanelOutter" BackgroundCssClass="bgModal">
        </cc1:ModalPopupExtender>

Open in new window

sk1922Asked:
Who is Participating?
 
masterpassConnect With a Mentor Commented:
Try to wrap the controls with an updatepanel
<asp:UpdatePanel ID="someid" runat="server">
<asp:Panel ID="PanelOutter" runat="server" CssClass="modalBoxImg" Style="display: none;">
        <div class="modalInner">
        <div class="modalTitle">
        I am ...
        </div>
        <asp:GridView ID="gv1" runat="server" DataKeyNames="EMP_ID" OnRowCommand="gv1_RowCommand">
        <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:LinkButton ID="selectEmp" runat="server" CommandArgument='<%# Eval("EMP_ID") %>' CommandName="Select">View Details</asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
        </Columns>
        </asp:GridView>
        <asp:Button ID="Process" runat="server" Text="This is me" />
        <asp:Button ID="Cancel" runat="server" Text="Cancel" />
        <asp:Label ID="Label1" runat="server" />
        </div>
        </asp:Panel>
        <asp:Button ID="ShowBtn" runat="server" Text="Button" Style="display: none;" />
        <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="ShowBtn" CancelControlID="Cancel" PopupControlID="PanelOutter" BackgroundCssClass="bgModal">
        </cc1:ModalPopupExtender></asp:UpdatePanel>

Open in new window

0
 
David RobitailleConnect With a Mentor Analyst ProgrammerCommented:
masterpass is right but he forgot the "<ContentTemplate>"
<asp:UpdatePanel ID="someid" runat="server"> 
<ContentTemplate>
<asp:Panel ID="PanelOutter" runat="server" CssClass="modalBoxImg" Style="display: none;"> 
        <div class="modalInner"> 
        <div class="modalTitle"> 
        I am ... 
        </div> 
        <asp:GridView ID="gv1" runat="server" DataKeyNames="EMP_ID" OnRowCommand="gv1_RowCommand"> 
        <Columns> 
        <asp:TemplateField> 
            <ItemTemplate> 
                <asp:LinkButton ID="selectEmp" runat="server" CommandArgument='<%# Eval("EMP_ID") %>' CommandName="Select">View Details</asp:LinkButton> 
            </ItemTemplate> 
        </asp:TemplateField> 
        </Columns> 
        </asp:GridView> 
        <asp:Button ID="Process" runat="server" Text="This is me" /> 
        <asp:Button ID="Cancel" runat="server" Text="Cancel" /> 
        <asp:Label ID="Label1" runat="server" /> 
        </div> 
        </asp:Panel> 
        <asp:Button ID="ShowBtn" runat="server" Text="Button" Style="display: none;" /> 
        <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="ShowBtn" CancelControlID="Cancel" PopupControlID="PanelOutter" BackgroundCssClass="bgModal"> 
        </cc1:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>

Open in new window

0
 
sk1922Author Commented:
Awesome! That did it.

I appreciate the insight experts!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.