469,568 Members | 1,372 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,568 developers. It's quick & easy.

Problem with ModalPopupExtender(AJAX) + C#

Hi all.
I am having trouble getting a ModalPopupExtender 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:
Expand|Select|Wrap|Line Numbers
  1. protected void grdBookings_RowDataBound(object sender, GridViewRowEventArgs e)
  2. {
  3.  if (e.Row.RowType == DataControlRowType.DataRow)
  4.             {
  5.                 Button Details1 = (Button)e.Row.FindControl("details1");
  6.                 Details1.Attributes.Add("onclick", "return ShowMyModalPopup('" + grdBookings.DataKeys[e.Row.RowIndex].Values + "')");
  7.             }
  8. }
ModalPopupExtender Code:
Expand|Select|Wrap|Line Numbers
  1. <asp:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID="ModalPopupExtender1Behaviour" runat="server" 
  2. PopupControlID="Panel1" TargetControlID="details1" BackgroundCssClass="modalBackground" 
  3. OnCancelScript="HideModalPopup()" CancelControlID="Close"></asp:ModalPopupExtender>
There is a warning stating Possible NullReferenceException at line grdBookings.DataKeys[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.
Dec 31 '09 #1
0 1822

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by brett | last post: by
reply views Thread by =?Utf-8?B?SGFyZHkgV2FuZw==?= | last post: by
1 post views Thread by Victor | last post: by
2 posts views Thread by =?Utf-8?B?UGF1bA==?= | last post: by
3 posts views Thread by Bobby Edward | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.