| 网站首页 | 业界新闻 | 群组 | 人才 | 技术文章 | 下载频道 | 博客 | 代码贴 | 编程论坛
共有 606 人关注过本帖
标题:求思路
只看楼主 收藏
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:12
帖 子:1613
专家分:3571
注 册:2011-3-24
结帖率:98.59%
  问题点数:0  回复次数:14   
求思路
如何让使用者点选Listview的项目后
能将点选的值传递到同网页的另一个地方?

程式有点长贴不上来只贴关键部分

<asp:LinkButton ID="FileMemo" runat="server" Font-Size="10px" ForeColor="#CC0066" Text='<%# GetClassName(0,Eval("ClassID"),Eval("SubClassID"),Eval("FileNo"))%>' ToolTip='<%# GetClassName(1, Eval("ClassID"), Eval("SubClassID"), Eval("FileNo"))%>' />


具体的说想让使用者在点选LinkBut​​ton后透过Code Behind的ListView_ItemCommand()取得真实路径后怎么传到<source src="???" type="video/mp4">里面?
这个传递参数的部分要怎么做?

程序代码:

                        <table width ="730" border="1">
                            <tr>
                                <td align="center">
                                    <video width="720" height="540" controls>
                                        <source src="/BTA/Personal/AAA.mp4" type="video/mp4">
                                        您的浏览器不支援此 HTML5 影片标签
                                    </video>
                                </td>
                            </tr>
                        </table>

搜索更多相关主题的帖子: 如何  网页  项目  
2017-06-02 12:10
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:12
帖 子:1613
专家分:3571
注 册:2011-3-24
  得分:0 
如图
.aspx


ListView_ItemCommand()
程序代码:

Protected Sub ListView2_ItemCommand(sender As Object, e As System.Web.UI.WebControls.ListViewCommandEventArgs) Handles ListView2.ItemCommand
        Dim hdfFileListNo As HiddenField = e.Item.FindControl("hdfFileListNo")
        Dim hdfFileListSubNo As HiddenField = e.Item.FindControl("hdfFileListSubNo")
        Dim hdfFileName As HiddenField = e.Item.FindControl("hdfFileName")
        Dim FileMemo As LinkButton = e.Item.FindControl("FileMemo")
        Dim strFilePath As String = ConfigurationManager.AppSettings(strCnnType & "BTA_FileMgn_Files").ToString & "\" & hdfFileListNo.Value & "\" & hdfFileListSubNo.Value & "\" & hdfFileName.Value & ".mp4"
        pnlMyClassList.Visible = False
        PnlClassView.Visible = True
        LabMyClassEng.Text = "My Curriculun"
        LabMyClassChi.Text = "我的課程 - " & hdfFileName.Value
        'Call clsFile.FileOpenMP4(strFilePath)

        If e.CommandName = "CourseTitleNoDetailMod" Then

        End If
    End Sub
附件: 您没有浏览附件的权限,请 登录注册

不要選我當版主
2017-06-02 12:16
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:12
帖 子:1613
专家分:3571
注 册:2011-3-24
  得分:0 
暂时找到解法但又有新问题
用Response.Write()搞定

但是能把ASP元件也写进去吗?
还是只能单纯对HTML做反应?

程序代码:

Protected Sub ListView2_ItemCommand(sender As Object, e As System.Web.UI.WebControls.ListViewCommandEventArgs) Handles ListView2.ItemCommand
        Dim hdfFileListNo As HiddenField = e.Item.FindControl("hdfFileListNo")
        Dim hdfFileListSubNo As HiddenField = e.Item.FindControl("hdfFileListSubNo")
        Dim hdfFileName As HiddenField = e.Item.FindControl("hdfFileName")
        Dim FileMemo As LinkButton = e.Item.FindControl("FileMemo")
        Dim strFilePath As String = ConfigurationManager.AppSettings(strCnnType & "BTA_Class_Files").ToString & "/" & hdfFileListSubNo.Value & "/" & hdfFileName.Value
        Dim MyString = ""

        MyString += "<table border=""1"">"
        MyString += "<tr>"
        MyString += "<td align=""right"">"
        MyString += "<a href=""http://x.x.x.x/bta/personal/ClassQuery.aspx?qry=Class"">回前页</a>"   '这地方没法嵌入ASP语法蛮刺眼的
        MyString += "</td>"
        MyString += "</tr>"
        MyString += "<tr>"
        MyString += "<td align=""center"">"
        MyString += "<video width=""100%"" height=""90%"" controls=""true"" autoplay=""true"">"
        MyString += "<source src="
        MyString += Chr(34) & strFilePath & Chr(34)
        MyString += " type=""video/mp4"">"
        MyString += "您的浏览器不支援此 HTML5 影片标签"
        MyString += "</video>"
        MyString += "</td>"
        MyString += "</tr>"
        MyString += "</table>"

        Response.Write(MyString)
        Response.End()

    End Sub



[此贴子已经被作者于2017-6-15 20:58编辑过]


不要選我當版主
2017-06-15 20:54
wangnannan
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:87
帖 子:2536
专家分:9359
注 册:2007-11-3
  得分:0 
有这么几种方法
第一种 asp.net后台调用前台js 参考ClientScript

第二种 你可以后台写个服务 然后客户端用ajax调用 返回数据 根基jquery赋值src就可以了
本帖最近评分记录
  • wube 积分 +10 好文章 2017-6-16 12:54

出来混,谁不都要拼命的嘛。 。拼不赢?那就看谁倒霉了。 。有机会也要看谁下手快,快的就能赢,慢。 。狗屎你都抢不到。 。还说什么拼命?
2017-06-16 09:38
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:12
帖 子:1613
专家分:3571
注 册:2011-3-24
  得分:0 
以下是引用wangnannan在2017-6-16 09:38:05的发言:

有这么几种方法
第一种 asp.net后台调用前台js 参考ClientScript

第二种 你可以后台写个服务 然后客户端用ajax调用 返回数据 根基jquery赋值src就可以了



JS是我的弱点~完全看不懂~需要买书来研究一下~

不要選我當版主
2017-06-16 12:54
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:12
帖 子:1613
专家分:3571
注 册:2011-3-24
  得分:0 
<a href=""http://x.x.x.x/bta/personal/ClassQuery.aspx?qry=Class"">回前页</a>

为何我点了这个连结后无法触发这个ClassQuery.aspx网页的Page_Load事件?
这样我才能计算使用者看了多久~再把时间写回数据库里~进而评断使用者是否通过最低观看时间~
最后再定时汇整资料使用AutoMail告知使用者的主管使用者的学习状况~
最后在稽查人员评定部门新进人员学习状况时~把数据库的资料汇出到EXCEL表中~

这就是需求者的完整要求~

[此贴子已经被作者于2017-6-16 13:05编辑过]


不要選我當版主
2017-06-16 12:59
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:12
帖 子:1613
专家分:3571
注 册:2011-3-24
  得分:0 
1.个别登入使用者阅读资料清单列表(已完成)
2.个别登入使用者播放阅读资料功能(已完成?)
3.管理者新增阅读资料和自动寄信通知(已完成)
4.管理者新增删除修改个别使用者阅读资料表单(已完成)
5.管理者查阅查阅数据库使用者阅读状况列表(已完成)
6.管理者评定使用者阅读资料后的科目评分(未完成)
7.定时寄送信件以EXCEL格式通知各管理者所有使用者的阅读状况和分数(未完成)

这全部功能都在ClassQuery.aspx同一个页面中

全公司有将近3万个员工~我的老天鹅阿~

[此贴子已经被作者于2017-6-16 13:19编辑过]


不要選我當版主
2017-06-16 13:17
wangnannan
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:87
帖 子:2536
专家分:9359
注 册:2007-11-3
  得分:0 
1 计算学习时间 一般都是通过视频播放控件 计算课件播放时间 例如ckplayer 获取当前视频播放进度和播放时间
2 定时发送mail可以考虑自己写个线程 或者用现成的调度框架

a 标签不触发Page_Load 需要判断是否ispostback



出来混,谁不都要拼命的嘛。 。拼不赢?那就看谁倒霉了。 。有机会也要看谁下手快,快的就能赢,慢。 。狗屎你都抢不到。 。还说什么拼命?
2017-06-16 15:52
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:12
帖 子:1613
专家分:3571
注 册:2011-3-24
  得分:0 
使用者又要新增功能〜假若有20堂课〜使用者设定起始时间为2017/06/16〜
课程完毕日期则为2017/08/11〜
每堂课阅读期限自动以两日往后累计〜并忽略六日〜

因为使用者懒....

还好在网路有看到一段适用的代码

程序代码:

Protected Sub btnQuery_Click(sender As Object, e As System.EventArgs) Handles btnQuery.Click
        Dim FileNo1 As String = "", FileNo2 As Integer = 0, FileNo3 As Integer = 0
        Dim ClassName = ""
        Dim mySQL As String = ""
        Dim UserN As String = Mid(Mid(UserNo.Text, InStr(UserNo.Text, "(") + 1), 1, Len(Mid(UserNo.Text, InStr(UserNo.Text, "(") + 1)) - 1)
        Dim strMsg As String = ""
        Dim TempTime() As String
        Dim ST As String = ""
        Dim ET As String = ""
        Try
            For i = 0 To ClassNo.Items.Count - 1
                If ClassNo.Items(i).Value <> "" Then
                    ClassName = Mid(ClassNo.Items(i).Value, InStr(ClassNo.Items(i).Value, " ") + 1)
                    mySQL = "SELECT SubjectNo, SubFolderNo, FileNo FROM tblFileList Where FileName = '" & ClassName & "'"
                    Using mySqlDS = New SqlConnection(ConfigurationManager.ConnectionStrings(strCnnType & "DbBTA").ToString)
                        Dim myCmd As SqlCommand
                        myCmd = New SqlCommand(mySQL, mySqlDS)
                        mySqlDS.Open()
                        Using dbDRSQL = myCmd.ExecuteReader
                            While dbDRSQL.Read
                                FileNo1 = dbDRSQL("SubjectNo").ToString
                                FileNo2 = dbDRSQL("SubFolderNo").ToString
                                FileNo3 = dbDRSQL("FileNo").ToString
                            End While
                        End Using
                    End Using

                    If i = 1 Then
                        TempTime = Split(starttime.Text, "-")
                    Else
                        TempTime = Split(ST, "/")
                    End If

                    ST = New DateTime(CInt(TempTime(0)), CInt(TempTime(1)), CInt(TempTime(2)))
                    ET = DTAdd(ST, (1 * 2)).ToShortDateString()

                    Using myCnn As New SqlConnection(ConfigurationManager.ConnectionStrings(strCnnType & "DbBTA").ToString)
                        myCnn.Open()
                        Dim myCmd As SqlCommand
                        mySQL = "INSERT INTO tblSelectClass(UserID, ClassID, SubClassID, FileNo, StartDate, EndDate, StudyTime, StudyCount, StudyDate, Results, CreatorNo, CreateDate, ReviserNo, ReviseDate) VALUES ("
                        mySQL += "'" & UserN & "', '" & FileNo1 & "', " & FileNo2 & ", " & FileNo3 & ", '" & ST & "', '" & ET & "', " & CInt(studytime.Text) & ", "
                        mySQL += "0,'1900-01-01','N','" & Session("LoginNo") & "', GetDate() ,'" & Session("LoginNo") & "', GetDate())"
                        myCmd = New SqlCommand(mySQL, myCnn)
                        myCmd.ExecuteNonQuery()
                    End Using
                    If MailToUser.Checked = True Then
                        Call SendEmail_ClassList_Add("新增课程", UserN, FileNo1, FileNo2, FileNo3, Memo.Text)
                    End If

                    ST = ET : ET = ""
                End If
            Next
            strMsg = "档案新增成功!"
        Catch ex As Exception
            'Response.Write("<b>●●● 请洽程式管理员●●●<br />程式错误讯息如下</b><br />" + ex.ToString() + "<HR />")
            Dim strErr As String = "●●● 程式错误讯息如下 ●●●" & "\n\n" & Replace(Replace(Replace(Replace(Trim(ex.ToString()), Chr(10), ""), Chr(13), ""), "\", "\\"), "'", "\'")
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alert", "alert('" & strErr & "');", True)
        End Try
        If strMsg <> "" Then
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "NotifyMsg", "alert('" & strMsg & "');", True)
            Call RestData()
        End If
    End Sub

    Protected Sub starttime_TextChanged(sender As Object, e As EventArgs) Handles starttime.TextChanged
        Dim TempTime() As String = Split(starttime.Text, "-")
        Dim Current_dt As DateTime = New DateTime(CInt(TempTime(0)), CInt(TempTime(1)), CInt(TempTime(2)))
        endtime.Text = (DTAdd(Current_dt, ((ClassNo.Items.Count - 1) * 2)).ToShortDateString())
    End Sub

    Private Function DTAdd(dt As DateTime, addday As Integer) As DateTime
        Dim i As Integer = 1
        While (i <= addday)
            dt = dt.AddDays(1)
            If ((dt.DayOfWeek.ToString() <> "Saturday") And (dt.DayOfWeek.ToString() <> "Sunday")) Then
                i += 1
            End If
        End While
        Return dt
    End Function

不要選我當版主
2017-06-16 18:44
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:12
帖 子:1613
专家分:3571
注 册:2011-3-24
  得分:0 
以下是引用wangnannan在2017-6-16 15:52:41的发言:

1 计算学习时间 一般都是通过视频播放控件 计算课件播放时间 例如ckplayer 获取当前视频播放进度和播放时间
2 定时发送mail可以考虑自己写个线程 或者用现成的调度框架

a 标签不触发Page_Load 需要判断是否ispostback

1.奇怪的是Windows 2012R2里找不到任何播放媒体的控件
2.发送mail是可以问题在怎么定时

ispostback我有写啊〜但是就是不触发〜还是因为我连结路径直接使用
http://x.x.x.x/bta/personal/ClassQuery.aspx?qry=Class
的缘故?

ClassQuery.aspx.vb
程序代码:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Session("CurrDivPage") = "BTA"
        If CInt(Session("LevelBTA")) <= 0 Then
            ClientScript.RegisterStartupScript(Me.GetType(), "Alert", "alert('您尚未登入!或已连线逾时!'); location.href='/bta/default.aspx';", True)
            Exit Sub
        ElseIf CStr(Session("RDMember")) = "N" Then
            ClientScript.RegisterStartupScript(Me.GetType(), "Alert", "alert('您并非研发中心成员,无法使用『配件管理』功能!'); location.href='/bta/default.aspx';", True)
            Exit Sub
        ElseIf CInt(Session("LevelBTA")) < 20 Then
            ClientScript.RegisterStartupScript(Me.GetType(), "Alert", "alert('您的BTA权限不够,无法使用『配件管理』功能!'); location.href='/bta/default.aspx';", True)
            Exit Sub
        End If
        ScriptManager.GetCurrent(Me.Page).RegisterPostBackControl(lkbExcel)
        If Not IsPostBack Then
            If Request.QueryString("type") = "Query" Then
                If CheckIsEmpGroupMember("BTA", "知识管理员", Session("LoginNo")) = True Or CInt(Session("LevelBTA")) > 30 Then
                    pnlMyClassList.Visible = False
                    lblTitleChi.Text = "课程查询"
                    lblTitleEng.Text = "CLASS QUERY"
                    pnlQueryResult.Visible = False
                Else
                    ClientScript.RegisterStartupScript(Me.GetType(), "Alert", "alert('您的BTA权限不够,无法使用『课程查询』功能!'); location.href='/bta/personal/default.aspx';", True)
                    Exit Sub
                End If
            Else 'If Request.QueryString("qry") = "Class" Then
                If CheckIsEmpGroupMember("BTA", "知识管理员", Session("LoginNo")) = True Or CInt(Session("LevelBTA")) > 30 Then
                    lkbClassToAdmin.Enabled = True
                Else
                    lkbClassToAdmin.Enabled = False
                    lkbClassToAdmin.ForeColor = Drawing.ColorTranslator.FromHtml("#999999")
                End If
                pnlQueryCondition.Visible = False
                Call LoadMyClass(0, Session("LoginNo"))
            End If
            PnlClassView.Visible = False
            Call GetDepNo()
            ClassNo.Enabled = False
            endtime.Enabled = False
            SellectAll.Checked = True
        End If
    End Sub

不要選我當版主
2017-06-16 19:02









关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.060327 second(s), 9 queries.
Copyright©2004-2017, BCCN.NET, All Rights Reserved