Alphalinks in FormView

Can anybody help me, I am trying to find some code for alphalinks on a formview.

jonmaz7 

Hi, 

jonmaz7

find some code for alphalinks

What do you mean by alphalinks?

Grz, Kris.

 I have about 7,000 plants in a treeview, and want to be able to click on Alphabet letter to go to instead of scrolling right through. (hyperlinks)

jonmaz7 

Hi alphalink is used in this website example.

http://www.4guysfromrolla.com/articles/052307-1.aspx

So you're looking for something where you click on a specific letter [D] and see all the records that begin with that letter?

[RESOLVED] Gridview select check box

Hi, following my code 

Gridview values:

A section:
ex: A001,A002....
B section:
ex: B001,B002...

My Output:

B001 B001

Note: label1.Text=Session["aaa"].ToString()+Session["bbb"].ToString();




protected void CheckBoxDone_CheckedChanged(object sender, EventArgs e)
{

q = Session["sk"].ToString();



if (q == "A")
{


int count = 0;

for (int r = 0; r < gvdata.Rows.Count; r++)
{
CheckBox chk1 = (CheckBox)gvdata.Rows[r].FindControl("myCheckBox");

if (chk1.Checked == true)
{
count = count + 1;
cellSelect1 = gvdata.Rows[r].Cells[2].Text;
// a1 += cellSelect + ",";
a1 += cellSelect1;
}

}

Session["aaa"] = a1;

}

qq = Session["sk1"].ToString();

if (qq == "B")
{



for (int r = 0; r < gvdata.Rows.Count; r++)
{
CheckBox chk2 = (CheckBox)gvdata.Rows[r].FindControl("myCheckBox");

if (chk2.Checked == true)
{
cellSelect2 = gvdata.Rows[r].Cells[2].Text;
b1 += cellSelect2;
}

}

Session["bbb"] = b1;
}
}

Hi krishnaraj_cdrr,

What is Session["sk"] and Session["sk1"]?

If you are trying to display the selections on the label, as Session["aaa"] and Session["bbb"] will return the same value, you can try this

Label1.Text = Session["aaa"].ToString();

or

Label1.Text = Session["bbb"].ToString();

Regards

[RESOLVED] FileUPload control not uploading file !

Hi All,

I am struggling with the most irritating and anoying problem! And also the simplest one that I just can't seem to shake:

I have a simple web form with a ASP.net Server FileUpload control. When clicked, the user must select a file (an XLSX file in this particular case) and save this file to the server file system. Simple, right? It should be, but somehow my attempts are vastly misguided. Here is my code, what the heck am I doing wrong??

Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
        Dim LoadedFile As String = Server.MapPath("~/UploadedFiles/_" & MyHCP.GetClubName(Profile.CurrentClubID) & ".xlsx")

        If Excel1.HasFile Then
            Excel1.SaveAs(LoadedFile)
            LabelUpload.Text = "(" & LoadedFile & ") was attached"
        Else
            LabelUpload.Text = "(" & LoadedFile & ")" & " did not upload correctly"
        End If
    End Sub

Hi

Use the following:

If Excel1.HasFile Then
            Excel1.PostedFile.SaveAs(LoadedFile)
...........
......

Hi Adeel,

Thank you very much. My probelm, however, is this: My conditions on "HasFile"
 never ever execute, meaning that the FileUpload controls do not seem to actually grab the file...

It just jumps to the "else" statement directly...

Is there a way I can ensure that the FileUpload control actually grabs the file?

Humm,

Make sure that your page is not posted back more than once. If it is posted back twice, then it can cause the problme.

Hi There,

Here is what I am trying now, but it still does not work. Is there a problem with my Visual Studio installation, or is this a probelm with ASP.net here? This is not Rcoket Science, and still is does not seem to work at all... Am I actually doind somehting wrong here?

If Not Page.IsPostBack Then
            If FileUpload1.HasFile Then
                FileUpload1.PostedFile.SaveAs(Server.MapPath("~/UploadedFiles/" & FileUpload1.PostedFile.FileName))
                LabelUpload.Text = FileUpload1.PostedFile.FileName & " was uploaded"
            Else
                LabelUpload.Text = "File was not uploaded"
            End If
        End If

I wonder why have you post back check. Post back will happen when the user clicks on the button. Anyways following code is working perfectly with me: [Simply try to past the code in the click on a button and test]

If FileUpload1.HasFile Then
                FileUpload1.PostedFile.SaveAs(Server.MapPath(".") & "/UploadedFiles/" & FileUpload1.FileName))
                LabelUpload.Text = FileUpload1.PostedFile.FileName & " was uploaded"
            Else
                LabelUpload.Text = "File was not uploaded"
            End If

this article might helps you...

http://forums.techarena.in/software-development/1192431.htm

Yeah, that doesn't work. It keeps executing the else statement. Nothing more. Can ASP.net even upload files??

Hi Adeel,

I am having no luck. Is there a way I can cvode this manually? ASP.net does not seem to be able to upload files. Perhaps if I wrote the code myself, my chances would improve, rather than having to rely on "pre-written" code that clearly does not work...

are you using update panels?

if so, you might want to try using this: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AsyncFileUpload/AsyncFileUpload.aspx

Nope. I have the AjaxControl Toolit, but I'm not using it here. I just wrote a little separate TestWebsite whit the exact same code I am using in my main website. It works in the smaller website but not in my main site. No update panels, no AJAX anywhere on the page where I am trying to upload a simple file.

I simply CANNOT understand why this bloody thing does not want to upload files...

what error are you get

 

Hi Deyken

This file works fine on my computer.

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm2.aspx.vb" Inherits="vbtest2.WebForm2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:FileUpload ID="Excel" runat="server" />
    <br />
    <br />
    <asp:Button ID="Button" runat="server" Text="Button" />
    </form>
</body>
</html>

.vb:
Public Class WebForm2
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button.Click
        If Excel.HasFile Then
            Response.Write("get file")
        Else
            Response.Write("not get file")
        End If
    End Sub
End Class

try this on you computer if it works fine that means your upload control work, else try to find other reason.

I use vs2010 for the project

OnSubmit Timing

Am using the form OnSubmit event to perform a function that displays a hidden <div> when a postback occurs.

It works on all desktop browsers Firefox, IE, Safari, Opera, etc but fails to work on most Smartphone browsers - particularly on Android platform.

My guess it's a timing issue because it will fail if postback was caused by a checkbox change but will work if the postback is caused by a select on a listview.

Are postbacks handled differently than "Submits"?  if so, how do I insure the function as shown below executes before the postback code?

    function waitpanel(id) {
            var e = document.getElementById(id);
            e.style.display = 'block';
        }
 

<body>
    <form id="form1" runat="server" onsubmit="waitpanel('WaitDiv')">
        <div id="WaitDiv" style="background-color: #ccc; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 999; display: none">


If I understand correctly, you are displaying a 'Wait' message, which is displayed after the user causes a postback through either a checkbox click or a listview select, but before the postback occurs?

If this is the case, I am wondering how long you see the wait panel. My guess is very quickly.

I think that this kind of wait panel would be more useful if you are using AJAX. You can show the wait panel during the asynchronous call. You would simply display it just before the AJAX call, and hide it again in the callback.

sivilian

Purpose is to show a wait message and block user from clicking button while new page loads with data answering his query.

Ajax works for me on y devel syatem but my production server (shared server we pay for monthly) doesn't seem to support Ajax inless I upgrade to a new plan at triple the cost.  Tried some AjaxControlToolkit samples and cant make them work on my hosted system.

Consequently I'm making a DIV visible when postback occurs.  It works on all browsers on desktop, works on Safari on Iphone and randomly works on different browsers in Droid phones.  I believe it' a timinmg issue because I can put a alert message in my make div visible function and see that it's being called but I don't see the wait panel appear during the 2-3 seconds it takes to retrieve data and present new screen.

I did some timing tests and find that OnSubmit happens 200-300 ms before the postback load event.

Only android browser for Droid X2 that works well is Firefox.

Try my sample at http://www.trims.com/ajtest on a smartphone and click checkbox