Click here to Skip to main content
15,916,693 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionExtracting web page using ASP Pin
Imthu13-Mar-07 1:27
Imthu13-Mar-07 1:27 
AnswerRe: Extracting web page using ASP Pin
Sandeep Akhare13-Mar-07 2:27
Sandeep Akhare13-Mar-07 2:27 
QuestionInvoking a datagrid from a "background thread"?? Pin
Nada Adel13-Mar-07 1:25
Nada Adel13-Mar-07 1:25 
Questionhow to send alerts/messages from server to clients Pin
dotnethunk13-Mar-07 1:15
dotnethunk13-Mar-07 1:15 
AnswerRe: how to send alerts/messages from server to clients Pin
badgrs13-Mar-07 2:43
badgrs13-Mar-07 2:43 
QuestionHow to increase CrystalReportViewer ToolBar horizental length/width using .NET Pin
Elena200613-Mar-07 0:26
Elena200613-Mar-07 0:26 
Questionusing file uploader in a gridview Pin
chathu03j12-Mar-07 23:53
chathu03j12-Mar-07 23:53 
AnswerRe: using file uploader in a gridview Pin
kubben13-Mar-07 3:36
kubben13-Mar-07 3:36 
You can put a file uploader in a gridview control, you just need to use a Item Template for the column you want it to be in.

Here is some sample code from Microsoft help:

Visual Basic  
Protected Sub Page_Load(ByVal sender As Object, 
        ByVal e As System.EventArgs) Handles Me.Load
    If IsPostBack Then
        Dim path As String = Server.MapPath("~/UploadedImages/")
        Dim fileOK As Boolean = False
        If FileUpload1.HasFile Then
            Dim fileExtension As String
            fileExtension = System.IO.Path. _
                GetExtension(FileUpload1.FileName).ToLower()
            Dim allowedExtensions As String() = _
                {".jpg", ".jpeg", ".png", ".gif"}
            For i As Integer = 0 To allowedExtensions.Length - 1
                If fileExtension = allowedExtensions(i) Then
                   fileOK = True
                End If
            Next
            If fileOK Then
                Try
                    FileUpload1.PostedFile.SaveAs(path & _
                         FileUpload1.FileName)
                    Label1.Text = "File uploaded!"
                Catch ex As Exception
                    Label1.Text = "File could not be uploaded."
                End Try
            Else
                Label1.Text = "Cannot accept files of this type."
            End If
        End If
    End If
End Sub


Hope that helps.
Ben




C#
protected void Page_Load(object sender, EventArgs e)
{
if(IsPostBack)
{
Boolean fileOK = false;
String path = Server.MapPath("~/UploadedImages/");
if (FileUpload1.HasFile)
{
String fileExtension =
System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
String[] allowedExtensions =
{".gif", ".png", ".jpeg", ".jpg"};
for (int i = 0; i < allowedExtensions.Length; i++)
{
if (fileExtension == allowedExtensions[i])
{
fileOK = true;
}
}
}

if (fileOK)
{
try
{
FileUpload1.PostedFile.SaveAs(path
+ FileUpload1.FileName);
Label1.Text = "File uploaded!";
}
catch (Exception ex)
{
Label1.Text = "File could not be uploaded.";
}
}
else
{
Label1.Text = "Cannot accept files of this type.";
}
}
}
QuestionError in deleting a file !!! Pin
amin_behzadi12-Mar-07 23:52
professionalamin_behzadi12-Mar-07 23:52 
AnswerRe: Error in deleting a file !!! Pin
Paddy Boyd13-Mar-07 0:37
Paddy Boyd13-Mar-07 0:37 
GeneralRe: Error in deleting a file !!! Pin
amin_behzadi13-Mar-07 1:01
professionalamin_behzadi13-Mar-07 1:01 
QuestionMsg is not displaying when a Enter Email that is already in Database Pin
siddisagar12-Mar-07 23:24
siddisagar12-Mar-07 23:24 
Questionis possible to draw on Image object at mousemove event? Pin
CodeBoi12-Mar-07 22:40
CodeBoi12-Mar-07 22:40 
AnswerRe: is possible to draw on Image object at mousemove event? Pin
badgrs13-Mar-07 2:41
badgrs13-Mar-07 2:41 
QuestionSpeed problem with Treeview Control Pin
Jeeva Mary Varghese12-Mar-07 22:26
Jeeva Mary Varghese12-Mar-07 22:26 
AnswerRe: Speed problem with Treeview Control Pin
N a v a n e e t h12-Mar-07 22:42
N a v a n e e t h12-Mar-07 22:42 
QuestionInternational standards Pin
Icarus12312-Mar-07 22:11
Icarus12312-Mar-07 22:11 
AnswerRe: International standards Pin
N a v a n e e t h12-Mar-07 22:21
N a v a n e e t h12-Mar-07 22:21 
QuestionAuto Documentation Pin
ADY00712-Mar-07 22:05
ADY00712-Mar-07 22:05 
Questionglobal variables Pin
vengaqua12-Mar-07 21:37
vengaqua12-Mar-07 21:37 
AnswerRe: global variables Pin
Sandeep Akhare12-Mar-07 22:09
Sandeep Akhare12-Mar-07 22:09 
GeneralRe: global variables Pin
vengaqua12-Mar-07 22:46
vengaqua12-Mar-07 22:46 
GeneralSessions Pin
ADY00712-Mar-07 22:49
ADY00712-Mar-07 22:49 
AnswerRe: global variables Pin
N a v a n e e t h12-Mar-07 22:23
N a v a n e e t h12-Mar-07 22:23 
GeneralRe: global variables Pin
vengaqua12-Mar-07 22:47
vengaqua12-Mar-07 22:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.