Code and stored procedure below error. The error I am getting is:
 *Value cannot be null. Parameter name: dataSet* *Description: *An unhandled 
exception occurred during the execution of the current web request. Please 
review the stack trace for more information about the error and where it 
originated in the code. 

*Exception Details: *System.ArgumentNullException: Value cannot be null. 
Parameter name: dataSet

*Source Error:* 

   An unhandled exception was generated during the execution of the current 
web request. Information regarding the origin and location of the exception 
can be identified using the exception stack trace below. 

*Stack Trace:* 

   [ArgumentNullException: Value cannot be null.
Parameter name: dataSet]
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +103
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
   _911PigeonAlert.AdminMenuControl.Page_Load(Object sender, EventArgs
e) in c:\inetpub\ryan\wwwroot\beta.911pigeonalert.org\admin\adminmenu.ascx.cs:41
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Control.LoadRecursive() +98
   System.Web.UI.Page.ProcessRequestMain() +750


 ------------------------------
 *Version Information:* Microsoft .NET Framework Version:1.1.4322.2032; 
ASP.NET <http://ASP.NET> Version:1.1.4322.2032 
  *Code:*
 
public void Page_Load(object sender, System.EventArgs e)

{

//_UserID = Convert.ToInt32(Session["UserID"]);

_UserID = Convert.ToInt32(Request.QueryString["UserID"]);

_MenuID = Convert.ToInt32(Request.QueryString["MenuID"]);

string proc;

SqlConnection conn = new SqlConnection((string) Application["conn"]);

proc = "GetSubMenuAccess";

SqlCommand cmd = new SqlCommand(proc, conn); 

cmd.CommandType = CommandType.StoredProcedure;

SqlParameter p1 = new SqlParameter("@ParentID", _MenuID);

p1.Direction = ParameterDirection.Input;

SqlParameter p2 = new SqlParameter("@UserID", _UserID);

p2.Direction = ParameterDirection.Input;

cmd.Parameters.Add(p1);

cmd.Parameters.Add(p2);

SqlDataAdapter adapter = new SqlDataAdapter(cmd);

adapter.Fill(ds);

AdminMenuRepeater.DataSource = ds.Tables[0].DefaultView;

AdminMenuRepeater.DataBind();

}

*Stored Procedure:*

CREATE PROCEDURE GetSubMenuAccess
(
@ParentID int,
@UserID int
)
AS
SELECT uma.SubMenuID, sm.Menu, sm.URL
FROM SubMenus sm
INNER JOIN UserMenuAccess uma
ON uma.SubMenuID = sm.SubMenuID
WHERE
sm.ParentMenuID = @ParentID AND uma.UserID = @UserID
ORDER BY sm.Menu ASC
GO

On 5/25/05, Dean Fiala <[EMAIL PROTECTED]> wrote: 
> 
> There a number of free/cheap menu packages available for .NET that
> will save you the work. Checkout
> http://www.asp.net/ControlGallery/default.aspx?Category=32&tabindex=2
> for an idea.
> 
> But if you want to do this yourself, start with web user control, add
> a repeater control, then add a hyperlink to the repeater's item
> template, like so...
> 
> <%@ Control Language="vb" AutoEventWireup="false"
> Codebehind="hm.ascx.vb" Inherits="Playground.hm <http://playground.hm/>"
> TargetSchema="http://schemas.microsoft.com/intellisense/ie5"; %>
> <asp:Repeater id="Repeater1" runat="server">
> <HeaderTemplate><table><tr></HeaderTemplate>
> <ItemTemplate>
> <td><asp:HyperLink ID="mnuItem" Runat="server"></asp:HyperLink></td>
> 
> </ItemTemplate>
> <FooterTemplate>
> </tr></table>
> </FooterTemplate>
> </asp:Repeater>
> 
> Then you simply bind it to the menu items returned from your stored proc.
> 
> Repeater1.DataSource =
> SomeFunctionThatCallsYourStoredProcAndReturnsAReaderOrDataTable()
> Repeater1.DataBind()
> 
> Add a ItemDataBound event handler to set your menu hyperlinks. For 
> example,
> 
> Private Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal
> e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
> Repeater1.ItemDataBound
> Dim hl As HyperLink
> Dim dr As DataRow
> If e.Item.ItemType = ListItemType.AlternatingItem Or
> e.Item.ItemType = ListItemType.Item Then
> hl = e.Item.FindControl("mnuItem")
> dr = e.Item.DataItem
> hl.Text = dr("Text")
> hl.NavigateUrl = Request.Url.LocalPath & "?mID=" & dr("ID")
> End If
> End Sub
> 
> You'll want to change the NavigateURL obviously and add some styling
> to the menu, but this is the basic way to create a dynamic horizontal
> menu.
> 
> -- 
> Dean Fiala
> Very Practical Software, Inc
> http://www.vpsw.com
> 
> ------------------------------
> *Yahoo! Groups Links*
> 
>    - To visit your group on the web, go to:
>    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
>    - To unsubscribe from this group, send an email to:
>    [EMAIL PROTECTED]<[EMAIL PROTECTED]>
>    - Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
>    Service <http://docs.yahoo.com/info/terms/>. 
> 
> 


-- 
Thank you,
Ryan Olshan
TeraNet Systems
http://www.teranetsystems.com


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to