BMXDad 23 Newbie Poster

Yes, so long as the UserId and Email used are unique, otherwise you could login as someone else.

BMXDad 23 Newbie Poster

Start a new post

BMXDad 23 Newbie Poster

If Im not using the SQL Membership I usually call a helper class that has a few methods just for this.

start here passing credentials:

    protected static bool LoginUser(string user, string pass)
    {
        Logger l = new Logger();

        return l.IsUser(user.Trim(), pass.Trim());
    }

The IsUser Class:

    /// <summary>
    /// Check to see if user is legal
    /// </summary>
    /// <param name="user">User name </param>
    /// <param name="pass">User password </param>
    /// <returns>True if is a user</returns>
    public bool IsUser(string user, string pass)
    {
        using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString))
        {
            bool b;
            //// Send info to DB and see if I get a record
            SqlCommand cmd = new SqlCommand("sproc", conn);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@user", user);
            cmd.Parameters.AddWithValue("@pass", pass);

            SqlParameter isAUser = cmd.Parameters.Add("@IsUser", SqlDbType.Char, 3);
            isAUser.Direction = ParameterDirection.Output;
            conn.Open();

            b = Convert.ToBoolean(cmd.ExecuteScalar().ToString());
            if (b)
            {
                string u = Convert.ToString(isAUser.Value);
                HttpContext.Current.Session["UserID"] = u;
                b = true;
            }
            else
            {
                b = false;
            }

            conn.Close();
            return b;
        }
    }

The bool value will be used to validate if user credentials are valid.

BMXDad 23 Newbie Poster

A very simple answer: Classic ASP is a scripting language and ASP.Net is a Compliled language. It all looks the same to the browser.

BMXDad 23 Newbie Poster

I'd go for ASP.Net. The languages that you can use are varied and the security available is some of the best.

BMXDad 23 Newbie Poster

Nothing wrong with classic ASP. I have many sites that I maintain that are still running ASP. And they work just as good as anything new. The only issue I have is the time needed for some of the reporting sites, but this only on the larger ones.

BMXDad 23 Newbie Poster

Generally, if its part of the page or menu structure then put it in the CSS, using the background-image property.

If its part of the content, then in the markup. That way you can make sure the Alt tag is filled out properly and an individual that's using an AT (Assistive Technology) device can understand what the image is about.

travis.holt.921_2 commented: I agree! +0
BMXDad 23 Newbie Poster

Some code snips to get you going, and it includes sorting to. I'm creating a DataSet for the initial load but then creating a DataTable and storing it in ViewState for the paging. You could also, for efficiency, call only the page that is going to be shown, but thats a different solution. As long as your not pulling thousands of records you should be ok.

First add an event to Gridview:

        AllowSorting="True"
        OnSorting="gvProgramOptions_Sorting"
        OnPageIndexChanging="gridView_PageIndexChanging"

Then, in the method used to populate the DataSet, add this:

        ViewState["DataTable"] = null;
        DataTable dt = ds.Tables[0];
        ViewState["DataTable"] = dt;

These are the methods used to show the selected page:

        protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gridView.DataSource = SortDataTable(ViewState["DataTable"] as DataTable, true);
            gridView.PageIndex = e.NewPageIndex;

            gridView.DataBind();
        }

        /// <summary>
        /// Sortable data table.
        /// </summary>
        /// <param name="dataTable">The data table.</param>
        /// <param name="isPageIndexChanging">if set to <c>true</c> [is page index changing].</param>
        /// <returns></returns>
        private DataView SortDataTable(DataTable dataTable, bool isPageIndexChanging)
        {
            if (dataTable != null)
            {
                gridView.EditIndex = -1;
                DataView dataView = new DataView(dataTable);
                if (GridViewSortExpression != string.Empty)
                {
                    dataView.Sort = string.Format("{0} {1}", GridViewSortExpression,
                                                  isPageIndexChanging ? GridViewSortDirection : GetSortDirection());
                }

                ViewState["DataTable"] = dataView.ToTable();
                return dataView;
            }
            return new DataView();
        }            

        /// <summary>
        /// Handles the Sorting event of the gridView control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewSortEventArgs"/> instance containing the event data.</param>
        protected void gridView_Sorting(object sender, GridViewSortEventArgs e)
        {
            GridViewSortExpression = e.SortExpression;
            gridView.DataSource = SortDataTable(ViewState["DataTable"] as DataTable, false);
            gridView.DataBind();
            gridView.UseAccessibleHeader = true; …
BMXDad 23 Newbie Poster

Like @geniusvishal said, No ... its a new Session.

However, if they open a seperate tab, it will still be reading the same Session. Something to be aware of.

BMXDad 23 Newbie Poster

Your styling the menu using the Left property, which is not working. also, the style.css is being called twice.

Try this tutorial on making a horizontal css menu ... its a classic thats been around for a long time.
listutorial and

BMXDad 23 Newbie Poster

Try in container:

padding: 0 auto;

BMXDad 23 Newbie Poster

Looks like an illusion ... the fiddle is working fine.

BMXDad 23 Newbie Poster

Only time you should redirect to a login page is if the user clicks a link to go there, or they've bookmarked a page that requires them to be authenticated. If they're just viewing public pages, then there is no reason to have a user login.

BMXDad 23 Newbie Poster

You don't need to disable viewstate, you can bump up the allowable size in the web.config:

<System.Web>
    <httpRuntime maxRequestLength="10000" />
</System.Web>

Another thing to watch out for is HttpValueCollection Key size. This is how many data elements are allowed on a page. Out of the box its around 1000, which is a decrease from framwwork 1.0. MS decreased it to prevent DoS attacks. On large gridviews this is easily exceeded, so to increase the number of keys allowable add this to the web.config:

<appsettings>
   <add key="aspnet:MaxHttpCollectionKeys" value="2000"></add>
</appsettings> 
BMXDad 23 Newbie Poster

Your hover style is going into effect (Lines 69 - 73).

I'd replace the images with text, for real text and style accordingly.

BMXDad 23 Newbie Poster

He was probably just scrapping the pages.

BMXDad 23 Newbie Poster

OK, so what did you do to fix it.

BMXDad 23 Newbie Poster

How are you initiating a class and adding parameter values?

BMXDad 23 Newbie Poster

Debug your code and make sure its being called.

BMXDad 23 Newbie Poster

Are you asking how to add the results to a database call?

     sqlConnection = new SqlConnection(dbConnectionString);
     SqlCommand command = new SqlCommand("sp_StoredProcedure", sqlConnection);
     command.CommandType = CommandType.StoredProcedure;
     command.Parameters.Add("@Id", SqlDbType.VarChar).Value = cbid.Text;
     command.Parameters.Add("@Checked", SqlDbType.Boolean).Value = cbid.checked;
     sqlConnection.Open();
     command.ExecuteNonQuery();
     sqlConnection.Close();
BMXDad 23 Newbie Poster

You need to change the return type on the function to DataSet .... line 21 shown above

BMXDad 23 Newbie Poster

stultuske, if I can make a web site show or do something that the programmer did not intend for me to see or do ... thats "Hacking". And through that you can attemplt some "Social Hacking". And there is source and generated source. Copying a generated source and modifying it has potential on any website.

BMXDad 23 Newbie Poster

This will export a GridView to Excel

   protected void btnExport_Click(object sender, EventArgs e)
    {
        Response.Clear();
        Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
        Response.Charset = string.Empty;

        // If you want the option to open the Excel file without saving then
        // comment out the line below
        // Response.Cache.SetCacheability(HttpCacheability.NoCache);

        Response.ContentType = "application/vnd.xls";
        System.IO.StringWriter stringWrite = new System.IO.StringWriter();
        HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
        gridView.RenderControl(htmlWrite);

        Response.Write(stringWrite.ToString());
        Response.End();
    }
BMXDad 23 Newbie Poster

If I'm reading you correctly, you want to be able to turn a group of links on and off from an admin page. To do so you would need a way to store the information, wheather they are visible or not and then be able to read that information on the page they are on.

An easy way is to handle this is to read and write to a simple text file. Not very secure, but it works well and is easy to implement.

BMXDad 23 Newbie Poster

Do you still want the popup to show?

BMXDad 23 Newbie Poster

Well ... you could view source and change hidden and/or disabled fields to visible and/or enabled. This in turn would allow you to post or get form information that would otherwise be unavailable.

From there ... .anything is possible.

BMXDad 23 Newbie Poster

This is always a problem with tabular data on a phone or tablet ... just not enough room for a big table.

What you could do is have a seperate table that is only shown, after the other is hidden, using media queries.

Another option is to check for a phone or tablets user agent and dynamically change the number of rows shown. Only issue with that is the User Agents for some of the higher end phones are becoming indistinguishable from a desktops.

BMXDad 23 Newbie Poster

Another new one to look at is sBlog. Fairly simple, but looks to have a lot of promise

sBlog.Net Project

FYI ... WordPress is PHP, not Asp.Net.

BMXDad 23 Newbie Poster

Fill with a DataSet, not a DataTable?

Dim dt As New DataSet

BMXDad 23 Newbie Poster

Look at your path where your calling the file.

BMXDad 23 Newbie Poster

Its sloppy, but works. But first you need to add an ID to the table so you can find it. After that you can loop through it and get your values.

        table.ID = "dataTable";



        protected void btn_Click(object sender, EventArgs e)
        {
            try
            {
                HtmlTable t = new HtmlTable();
                t = (HtmlTable) FindControl("dataTable");
                foreach (HtmlTableRow trc in t.Rows)
                {
                    foreach (HtmlTableCell tc in trc.Cells)
                    {
                        foreach (Control htc in tc.Controls)
                        {
                            var cb = htc as CheckBox;
                            if (cb != null)
                            {
                                Response.Write(cb.ID + " " + cb.Checked + "<br />");
                            }
                        }

                    }
                }

            }
            catch (Exception d)
            {
                Response.Write(d.Message);
            }
BMXDad 23 Newbie Poster

Be sure to register both dropdowns in the scriptmanager.

BMXDad 23 Newbie Poster

Concatentate them into a string.

string s = c_id.toString() + " - " +  C_name.toString() + " - " + C_contact.toString();
chkList1.Text = s;
BMXDad 23 Newbie Poster

MS Visual Studio can be downloaded for free, and can support almost any language with the proper plugin.

Visual Studio 2012 Express

BMXDad 23 Newbie Poster

Yes ... big problem when IE10 came out.

BMXDad 23 Newbie Poster

Are you writing the code in a script tag or in a code behind page?

Looks like a dynamically added image button is not posting back?

BMXDad 23 Newbie Poster

Another Down Vote? Hmm ... someone must not like my answers ;-)

Not all acrynoms are in caps. Radar and Scuba are, but you very rarely see them that way.

As for html being case insensative, yes it is. But for readability, uppercase is not the way to go.

Why Are You SHOUTING Programmer?

Hey there Troy III ... do you really think that Avatar is me? It's my son when he was 15, not when he was 12.

BMXDad 23 Newbie Poster

Blog Engine

Open source blog that has everything you need.

BMXDad 23 Newbie Poster

Hey Jorge, wasn't thinking of you, and your right ... sure would be a nice feature though to know why a down vote is given.

BMXDad 23 Newbie Poster

Down vote? Really? Mind if I ask why??

BMXDad 23 Newbie Poster

Not in the same list ... you get strange behaviour on collapse.

BMXDad 23 Newbie Poster

If the site is using a CMS and as long as the site is not presenting presentation elements in its code, any framework will do. Its simply a wrapper for your content. But like tomparker said ... "converting an ecommerce site of this magnitude to mobile is big undertaking".

If they kept a seperation of content and presentation it should be fairly cut and dried ... should be anyway. :-)

BMXDad 23 Newbie Poster

Boo on all caps ... makes it so hard to read. And beware the w3Schools, They have a lot of incorrect information ... alot!!

Read this article ... might help you out:
Why you should not learn html

BMXDad 23 Newbie Poster

Its a jQuery Div.

Empty it like this ...

$('#Somediv').empty();

You can add code to create a cookie so if they come back to the site it won't show again.

BMXDad 23 Newbie Poster

Change it .... only submit the form after the input values have been validated.

action="pagenamecheck.jsp"

should be

action="ValidateForm()"

where ValidatedForm() is a function that validates the page first, then returns "pagenamecheck.jsp" if validation is good.

BMXDad 23 Newbie Poster

Are you trying to add a query string to the current url, like this:

http://current.website.com/index.aspx?zoom=true

Try

   protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("default.aspx?zoom=true");
    }
BMXDad 23 Newbie Poster

How are you clearing the Sessions and Forms Authentication?

This should help:

FormsAuthentication.SignOut();
Session.Clear();

If you are simply doing a back button on the page it will still show the page as if you were logged in, but on refresh it should be ok.

BMXDad 23 Newbie Poster

It needs to be a seperate list. You could also set a style:

style="float:right;"
BMXDad 23 Newbie Poster

Like JorgeM said, reasearch on your own first. Sites like this are to help other programmers. They're not a collection of free programmers to get work from.

BMXDad 23 Newbie Poster

Like this:

HTML

    <form id="form1" runat="server">
    <asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="True">
        <asp:ListItem>One</asp:ListItem>
        <asp:ListItem>Two</asp:ListItem>
        <asp:ListItem>Three</asp:ListItem>
    </asp:DropDownList>
    <br />
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <br />
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
    </form>

Code Behind:

    protected void Button1_Click(object sender, EventArgs e)
    {
        string sText = TextBox1.Text;
        TextBox1.Text = string.Empty;
        DropDownList1.Items.Add(new ListItem(sText,sText));
    }