Hello Dear Sirs ,
about a problem in the download file Upload the file automatically when you click the link (download form database) , like image :
Code :
<asp:Repeater ID="RepeaterCourse" runat="server">
<ItemTemplate>
<div class="col-xs-12 col-sm-6 col-md-4 column threecol">
<div class="course-preview premium-course">
<div class="course-image">
<asp:Label ID="CourseLogo" runat="server" Text='<%# Eval("CourseLogo")%>'></asp:Label>
<div class="course-meta">
<div class="course-footer clearfix">
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandArgument='<%# Eval("BrochoreLink")%>'
class="sim-button button14" Style="line-height: 20px; color: white;">Download Brochore</asp:LinkButton>
</div>
</div>
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
Public Function FindCourse() As DataTable
GetConnection()
Dim SQL As String = "SELECT DISTINCT ScheduleNew.ScheduleID, ScheduleNew.CourseID , ScheduleNew.CityID, ScheduleNew.StartCourse, ScheduleNew.EndCourse, ScheduleNew.Days, ScheduleNew.CategoryID, Category.CategoryName , ScheduleNew.FieldID , Field.FieldName , ScheduleNew.MonthsID , Months.MonthsName , CoursesNew.CourseLogo , CoursesNew.EnglishName , CoursesNew.ArabicName , CoursesNew.BrochoreLink , (City.CityName +', ' +Country.CountryName) AS CityCountry FROM ScheduleNew ,CoursesNew , Country , City , Months , Category , Field Where Country.CountryID=City.CountryID AND City.CityID=ScheduleNew.CityID AND CoursesNew.CourseID=ScheduleNew.CourseID AND Months.MonthsID = ScheduleNew.MonthsID AND Category.CategoryID = ScheduleNew.CategoryID AND Field.FieldID = ScheduleNew.FieldID "
Dim dt As New DataTable
Dim da As New SqlDataAdapter(SQL, Conn)
If CountryID <> 0 Then
da.SelectCommand.CommandText = " AND City.CountryID = @CountryID"
da.SelectCommand.Parameters.Add("@CountryID", SqlDbType.Int).Value = CountryID
End If
If ScheduleID <> 0 Then
da.SelectCommand.CommandText &= "And ScheduleNew.ScheduleID =@ScheduleID"
da.SelectCommand.Parameters.Add("@ScheduleID", SqlDbType.Int).Value = ScheduleID
End If
If CourseID <> 0 Then
da.SelectCommand.CommandText &= "And ScheduleNew.CourseID =@CourseID"
da.SelectCommand.Parameters.Add("@CourseID", SqlDbType.Int).Value = CourseID
End If
If CityID <> 0 Then
da.SelectCommand.CommandText &= " And ScheduleNew.CityID =@CityID"
da.SelectCommand.Parameters.Add("@CityID", SqlDbType.Int).Value = CityID
End If
If StartCourse <> "" Then
da.SelectCommand.CommandText &= " And ScheduleNew.StartCourse Like @StartCourse "
da.SelectCommand.Parameters.Add("@StartCourse", SqlDbType.DateTime).Value = StartCourse
End If
If EndCourse <> "" Then
da.SelectCommand.CommandText &= " And ScheduleNew.EndCourse Like @EndCourse"
da.SelectCommand.Parameters.Add("@EndCourse", SqlDbType.DateTime).Value = EndCourse
End If
If MonthsID <> 0 Then
da.SelectCommand.CommandText &= " And ScheduleNew.MonthsID=@MonthsID"
da.SelectCommand.Parameters.Add("@MonthsID", SqlDbType.Int).Value = MonthsID
End If
If CategoryID <> 0 Then
da.SelectCommand.CommandText &= " And ScheduleNew.CategoryID=@CategoryID"
da.SelectCommand.Parameters.Add("@CategoryID", SqlDbType.Int).Value = CategoryID
End If
If FieldID <> 0 Then
da.SelectCommand.CommandText &= " And ScheduleNew.FieldID=@FieldID"
da.SelectCommand.Parameters.Add("@FieldID", SqlDbType.Int).Value = FieldID
End If
If Days <> 0 Then
da.SelectCommand.CommandText &= " And ScheduleNew.Days=@Days"
da.SelectCommand.Parameters.Add("@Days", SqlDbType.int).Value = Days
End If
da.SelectCommand.CommandText &= " order by StartCourse asc"
Try
da.Fill(dt)
Catch ex As Exception
'Error
Finally
Conn.Close()
End Try
Return dt
End Function
I want to download the file directly without going to another, page How is this?!
Thank You ..