469,950 Members | 2,285 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Sys.ArgumentNullException: Value cannot be null. Parameter name: element

Hi all

I am using the Ajax control toolkit and want to the fill the gridview but at the time of rendering it occurs the error "Sys.ArgumentNullException: Value cannot be null. Parameter name: element". Here am posting the whole .ascx page.

Will you please let me know how can i remove this error.






<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ViewUsers1.ascx.cs" Inherits="Controls_ViewUsers1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<ajaxToolkit:ToolkitScriptManager runat="Server" ID="ScriptManager1" />
<style>
/*Modal Popup*/.modalBackground
{
background-color: white;
filter: alpha(opacity=70);
opacity: 0.7;
}
</style>


<script type="text/javascript">
var styleToSelect;

// Add click handlers for buttons to show and hide modal popup on pageLoad
function pageLoad()
{

$addHandler($get("showModalPopupClientButton"), 'click', showModalPopupViaClient);
}

function showModalPopupViaClient(ev)
{

alert(this.id );
document.getElementsByName("hdnDeleteID").value=th is.id;

ev.preventDefault();
var modalPopupBehavior = $find('programmaticModalPopupBehavior');
modalPopupBehavior.show();
}

function hideModalPopupViaClient(ev)
{

ev.preventDefault();
var modalPopupBehavior = $find('programmaticModalPopupBehavior');
modalPopupBehavior.hide();
}



</script>

<table width="100%" id="ParentTable">
<tr>
<td>
<input type="hidden" id="hdnDeleteID" runat="server" />
<asp:Label ID="lblMessage" runat="server"></asp:Label>
<asp:Label ID="lblGridMess" runat="server" />
<asp:GridView ID="gvUsers" Width="100%" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataKeyNames="ID" OnPageIndexChanging="gvUsers_PageIndexChanging" AllowSorting="true"
OnRowCommand="gvUsers_RowCommand" OnRowDataBound="gvUsers_RowDataBound" PagerStyle-HorizontalAlign="left"
OnSorting="gvUsers_Sorting" OnRowDeleting="gvUsers_RowDeleting">
<Columns>
<asp:TemplateField Visible="False">
<ItemTemplate>
<asp:Label ID="lbl" runat="server" Text='<%#Eval("Email")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ID" HeaderText="User ID" Visible="False" />
<asp:TemplateField HeaderText="FirstName" SortExpression="FirstName">
<ItemTemplate>
<%#Eval("FName") %>
</ItemTemplate>
<ItemStyle Width="15%" HorizontalAlign="Left" />
<HeaderStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="EmailAddress" SortExpression="Email">
<ItemTemplate>
<%#Eval("Email") %>
</ItemTemplate>
<ItemStyle Width="30%" HorizontalAlign="Left" />
<HeaderStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<a href='' name='<%#Eval("ID") %>' id='<%#Eval("ID") %>' onclick='javascript:$addHandler($get(this.id), "click", showModalPopupViaClient);'>
Edit</a>
<%--<a href="#" name='<%#Eval("ID") %>' onclick="javascript:return GetUserData('<%#Eval("ID")%>')" >Edit</a>--%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<%--<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
CommandArgument='<%#Eval("ID")%>' Text="Delete"></asp:LinkButton>--%>
<a href='' name='<%#Eval("ID") %>' id='<%#Eval("ID") %>' onclick='javascript:$addHandler($get(this.id), "click", showModalPopupViaClient);'>
Delete</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle HorizontalAlign="Left" />
</asp:GridView>
</td>
</tr>
<tr>
<td>
<div class="demoarea">
<br />
<asp:Button runat="server" ID="hiddenTargetControlForModalPopup" Style="display: block"
Visible="false" />
<ajaxToolkit:ModalPopupExtender runat="server" ID="programmaticModalPopup" BehaviorID="programmaticModalPopupBehavior"
BackgroundCssClass="modalBackground" TargetControlID="hiddenTargetControlForModalPopup"
PopupControlID="programmaticPopup" DropShadow="True" PopupDragHandleControlID="programmaticPopupDragHan dle"
RepositionMode="RepositionOnWindowScroll">
</ajaxToolkit:ModalPopupExtender>
<asp:Panel runat="server" ID="programmaticPopup" Style="display: none; width: 350px;
padding: 10px" BackColor="White">
<asp:Panel runat="Server" ID="programmaticPopupDragHandle" Style="cursor: move; background-color: #DDDDDD;
border: solid 1px Gray; color: Black; text-align: center;">
User</asp:Panel>
<table width="200px">
<tr>
<td align="left">
Delete User
</td>
</tr>
<tr>
<td align="center">
Are you sure to delete the user?
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="btnOk" runat="server" Text="OK" OnClick="btnOK_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
</td>
</tr>
</table>
</asp:Panel>
</div>
</td>
</tr>
</table>
Dec 6 '07 #1
0 9376

Post your reply

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

Similar topics

2 posts views Thread by Tom C | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.