Problem with ModalPopupExtender(AJAX) + C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • uicouic
    New Member
    • Jan 2009
    • 24

    Problem with ModalPopupExtender(AJAX) + C#

    Hi all.
    I am having trouble getting a ModalPopupExten der to display with the corresponding data. This will be triggered by clicking on a "Details" button in a gridview. Eg. by clicking on Row1 details button, ModalPopup will display Row1 information

    I suspect this might be due to the following section:
    Code:
    protected void grdBookings_RowDataBound(object sender, GridViewRowEventArgs e)
    {
     if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    Button Details1 = (Button)e.Row.FindControl("details1");
                    Details1.Attributes.Add("onclick", "return ShowMyModalPopup('" + grdBookings.DataKeys[e.Row.RowIndex].Values + "')");
                }
    }
    ModalPopupExten der Code:
    Code:
    <asp:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID="ModalPopupExtender1Behaviour" runat="server" 
    PopupControlID="Panel1" TargetControlID="details1" BackgroundCssClass="modalBackground" 
    OnCancelScript="HideModalPopup()" CancelControlID="Close"></asp:ModalPopupExtender>
    There is a warning stating Possible NullReferenceEx ception at line grdBookings.Dat aKeys[e.Row.RowIndex]. I have not stated the DataSource in the gridview itself as Im not sure how to do so since Im using a custom Stored Procedure. Could this be a cause?

    I hope those in the know could help me as much as possible, thank you.
Working...