LinkButton In Repeater Not Firing with Div on Page

Hi All,

The page has a repeater with linkbuttons in it.  The buttons are not firing up events in the code behind when the lightbox is on the page.  

Outside of the Repeater is a LinkButton "Add New".  This makes the Lightbox show up.  The Lightbox is a <div> with <ajaxToolkit:ModalPopupExtender. (The lightbox Add New Meeting Notes form Works.) Also using javascript tinyMCE in the lightbox- couldn't get the AJAX one to work

When I remove the Lightbox <Div  and the <ajaxToolkit:ModalPopupExtender stays - the repeater linkbuttons work.  It goes to the code behind.  

When I mouse over the Edit link this is what shows up at the bottom:
javascript:WebForm_DoPostBackWithOptions(new WebFrom_PostBackOptions("ct100$contentplacceholder2$Repeater1$ct100$EditBtn", "", true, "", "", false,true))

 Here's the relavent code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Front page:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 <tr valign="top">
<td style="width: 149px" class="textBold" >Month: </td>
<td style="width: 412px">
<asp:DropDownList ID="MonthDD" runat="server" AutoPostBack="True">
<asp:ListItem Text="January" Value="1" ></asp:ListItem>
<asp:ListItem Text="February" Value="2"></asp:ListItem>
</asp:DropDownList>
</td>
<td style="text-align: right">
<asp:LinkButton ID="AddBtn" runat="server" class="textBold"  CausesValidation="false">Add New</asp:LinkButton>
</td>
<td style="width: 10px;"></td>
</tr>
<table cellpadding="3" cellspacing="0" style="border-style: inset; border-width: 1px; width: 730px">
<tr>
<td style="height:5px;" colspan="8"></td>
</tr>

<asp:Repeater ID="Repeater1" runat="server" >
<ItemTemplate>      
<%i = i +1 %>                          
<tr bgcolor = <%=(getRowColor(i)) %>>
<td style="width: 10px">&nbsp;</td>
<td style="width: 400px;"><%#Eval("thisMonth") %> <%#Eval("thisDay")%> / <%#Eval("id")%> </td>
<td style="text-align: right"><asp:LinkButton ID="EditBtn" runat="server" CommandName="Edit" CommandArgument='<%#Eval("id")%>' OnCommand="Repeater1_ItemCommand"   Text="Edit"></asp:LinkButton>
</td>
<td style="text-align: right" style="width: 40px">&nbsp;</td>
<td style="text-align: right" style="width: 40px">
<asp:LinkButton ID="PreviewBtn" runat="server" CommandName="Preview" CommandArgument='<%#Eval("id")%>' OnCommand="Repeater1_ItemCommand"  Text="Preview"></asp:LinkButton>
</td>
<td style="width: 40px">&nbsp;</td>
<td style="text-align: right" style="width: 40px">
<asp:LinkButton ID="DeleteBtn" runat="server" CommandName="Delete" CommandArgument='<%#Eval("id")%>'  OnCommand="Repeater1_ItemCommand"  Text="Delete"></asp:LinkButton>
</td>
<td style="width: 10px">&nbsp;</td>
</tr>
</ItemTemplate>
</asp:Repeater>

<tr>
<td style="height:5px;" colspan="8"></td>
</tr>
</table>
<%--~~~~~~~~~~~~        Add New Meeting Info  Area  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
<div id="divPopUP" align="center" style="display:none;width:860px;height:750px;border:solid1px#dddddd; top: 780px;  position: relative; ">
<table cellpadding="0" cellspacing="0" style="width: 843 px;" border="0">
<tr>
<td>
&nbsp;</td>
<td class="textBold" style="width: 174px" align="left">Meeting Date<font color="#990000">*</font>:</td>
<td class="style1" align="left"><asp:TextBox ID="AddMeetingDatetxt" runat="server" style="margin-bottom: 0px" Width="78px"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="AddMeetingDatetxt" PopupButtonID="CalendarBtn" >
</ajaxToolkit:CalendarExtender>
</td>

<td style="width: 524px;" align="left"><asp:ImageButton ID="CalendarBtn" runat="server"  ImageUrl="~/Tools/Images/Calendar2.gif" CausesValidation="false"/> <asp:RequiredFieldValidator ID="AddDateVld" runat="server" ErrorMessage="Please add a date" ControlToValidate="AddMeetingDatetxt" Display="Dynamic" CssClass="textBold" SetFocusOnError="True"></asp:RequiredFieldValidator></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
<td  class="textBold" align="left">Meeting Notes Text<font color="#990000">*</font>:</td>
<td colspan="2" valign="top">
<asp:RequiredFieldValidator ID="addMeetingTextVLD" runat="server" ErrorMessage="Please add meeting information" ControlToValidate="elm1" CssClass="textBold" Display="Dynamic" SetFocusOnError="True"></asp:RequiredFieldValidator>
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td> &nbsp;</td>
<td colspan="3" align="left">
<asp:TextBox ID="elm1" runat="server" TextMode="MultiLine" ClientIDMode="Static"  Width="766px" Height="500px" /></td>
<td> &nbsp;</td>
<tr>
<td>&nbsp;</td>
<td colspan="3" align="right">
<asp:Button ID="Button1" runat="server" Text="Preview" CausesValidation="False" />&nbsp;&nbsp;&nbsp;
<asp:Button ID="btnHide" runat="server" Text="Cancel" OnClick="btnHide_Click" CausesValidation="False" />&nbsp;&nbsp;&nbsp;
<asp:Button ID="SubmitAddBtn" runat="server" Text="Submit" />
</td>
<td>&nbsp;</td>
</tr>
<%--~~~~~~~~~~~~     END   Add New Meeting Info  Area  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
                       <ajaxToolkit:ModalPopupExtender ID="mpe1" runat="server" TargetControlID="AddBtn" PopupControlID="divPopUP" BackgroundCssClass="modalBackgroundClass" DropShadow="false">
</ajaxToolkit:ModalPopupExtender>      

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here's Code Behind:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  If Not (Page.IsPostBack) Then
            getNotesList()
            i = 1
  End If
End Sub

Protected Sub btnHide_Click(sender As Object, e As System.EventArgs) Handles btnHide.Click
    mpe1.Hide()
End Sub

'~~~~    Adding New Record
Protected Sub SubmitAddBtn_Click(sender As Object, e As System.EventArgs) Handles SubmitAddBtn.Click

    Dim mDate As Date = DateTime.Parse(AddMeetingDatetxt.Text, New System.Globalization.CultureInfo("en-US"))
    Dim mText As String = HttpUtility.HtmlEncode(elm1.Text)
    Dim updater As String = Request.Cookies("LastName").Value
    Dim con As SqlConnection = ExecNonQuerySQL.addData

    Dim strSQL As String = "INSERT INTO DeptMeetingNotes (meetingDate, meetingNotes, updatedDate, updatedBy ) VALUES "
    strSQL = strSQL + "( @sDate, @sText, getDate() , @sUpdater )"

    Dim cmd As New SqlCommand(strSQL, con)

    cmd.Parameters.AddWithValue("@sDate", mDate)
    cmd.Parameters.AddWithValue("@sText", mText)
    cmd.Parameters.AddWithValue("@sUpdater", updater)

    con.Open()
    Dim result As Integer = cmd.ExecuteNonQuery()
    lbl1.Text = result

    AddMeetingDatetxt.Text = ""
    elm1.Text = ""
    mpe1.Hide()

End Sub

'~~~~~~~~~~  Getting List of Notes for Month
Public Sub getNotesList()

    errorLBL.Text = ""
    Repeater1.DataSource = Nothing
    Repeater1.DataBind()

    Dim thisDate As Integer
    Dim strSQL As String
    Dim dr As SqlDataReader

    thisDate = MonthDD.SelectedValue

    strSQL = "SELECT id, Day(meetingDate) as thisDay, DateName(Month,meetingDate) as thisMonth FROM HeadMeetingNotes WHERE Month(meetingDate) = '" & thisDate & "'"
    dr = DataReaderClassIntranetSQL.GetDataReaderIntranetSQL(strSQL)
    If (dr.HasRows) Then
        Repeater1.DataSource = dr
        Repeater1.DataBind()
    Else
        errorLBL.Text = "<font color=red><b>There are no records found for this month.</b></font>"
    End If

End Sub

'~~~~~~~~~    LinkButtons for Edit / Preview / Delete
Protected Sub Repeater1_ItemCommand(sender As Object, e As CommandEventArgs)
    lbl10.Text = ""
    Dim s As String = e.CommandName
    lbl10.Text = s
    Dim t As String = e.CommandArgument
    lbl10.Text = t

    If (e.CommandName.Equals("Delete")) Then
    End If

    If (e.CommandName.Equals("Edit")) Then
        'lbl10.Text = "XXXXXXXXXXXXXXXXXX"
        mpe1.Show()
    End If

    If (e.CommandName.Equals("Preview")) Then
    End If

End Sub

Protected Function getRowColor(thisI As Integer) As String
    If (thisI Mod 2 > 0) Then
        Return "#E7EFF7"
    Else
        Return "#FFFFFF"
    End If

End Function

'~~~~~~~~~~   When User Selects Different Month to View Meeting Notes Records
Protected Sub MonthDD_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles MonthDD.SelectedIndexChanged
    getNotesList()
End Sub


Any Ideas?

JS
LVL 2
jshesekAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
AnuTijiConnect With a Mentor Commented:
Hi

For the linkbuttons inside the repeater set CausesValidation="false" and then give a try
0
 
jshesekAuthor Commented:
WOW that worked.  Thank you very much.
0
 
jshesekAuthor Commented:
Worked 100%
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.