You must Sign In to post a response.
  • Category: ASP.NET

    Mr. Ramasamy.N thanks to u... but.........

    str += "<td class=border><a href=fileMergeList.aspx?task_file_id=" & ds.Tables(0).Rows(i).Item("task_file_id") & "&level_id=" & ds.Tables(0).Rows(i).Item("level_id") & "> " & (i + 1).ToString & " </a></td>"

    <a href=fileMergeList.aspx? is worked.

    value passed in another page. but i want value in same page
    in List box fill.

    please help me.
  • #213985
    r u using asp.net . Can i have ur full code...
    Regards,
    M.Venkatesan.

    For Interview Question and Answers:
    http://dotnet-interview-qa.blogspot.com

    http://venkatdotnetexperiments.wordpress.com

  • #214010
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="T_FileMerge.aspx.vb" Inherits="smt.T_FileMerge.FileMergePage" %>

    <!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>Team</title>
    <link rel="stylesheet" type="text/css" id="link" runat="server" />

    <script language="javascript" type="text/javascript">
    var oldgridSelectedColor;

    function setMouseOverColor(element)
    {
    oldgridSelectedColor = element.style.backgroundColor;
    element.style.backgroundColor='#E9E9E8';
    element.style.cursor='hand';
    element.style.textDecoration='underline';
    }

    function setMouseOutColor(element)
    {
    element.style.backgroundColor=oldgridSelectedColor;
    element.style.textDecoration='none';

    }
    </script>

    </head>
    <body style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0" >
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <igmisc:WebPageStyler ID="Styler" runat="server" StyleSetName="" />
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr class="pageheader">
    <td>
    <asp:Label ID="lblHeader" runat="server" />
    </td>
    </tr>
    </table>
    <asp:UpdatePanel ID="Updatepanel2" runat="server">
    <ContentTemplate>
    <table id="Table2" runat="server" border="1" width="100%" cellpadding="0" cellspacing="0">
    <tr class="Error" visible="false" runat="server" id="trerror">
    <td>
    <asp:Label ID="lblErr" runat="server"></asp:Label>
    <input type="hidden" id="eID" runat="server" value="0" />
    </td>
    </tr>
    <tr class="headertext" runat="server" id="tr1">
    <td>
    Main File List
    </td>
    </tr>

    <tr>
    <td>
    <asp:GridView runat="server" HorizontalAlign="Center" ID="Grid1" Width="100%" AutoGenerateSelectButton="false"
    DataKeyNames="file_id" BorderStyle="None" BorderWidth="1px" CellPadding="2" AllowPaging="True"
    PageSize="15" AutoGenerateColumns="False" AllowSorting="true">
    <PagerSettings PageButtonCount="100" />
    <Columns>
    <asp:BoundField DataField="file_id" Visible="false" SortExpression="file_id" />
    <asp:BoundField DataField="file_name" HeaderText="File Name" ControlStyle-Font-Underline="false"
    SortExpression="file_name" />
    <asp:BoundField DataField="file_length" HeaderText="File Length" ControlStyle-Font-Underline="false"
    SortExpression="file_length" />
    <asp:CommandField ShowSelectButton="true" SelectText="Select" Visible="false" />
    </Columns>
    </asp:GridView>
    </td>
    </tr>
    <tr class="headertext" runat="server" id="tr2">
    <td>
    Task File List
    </td>
    </tr>
    <tr>
    <td>
    <div align="center" id="divTable" runat="server">
    <table visible=true id="tabfile" runat="server" ></table>

    </div>
    </td>
    </tr>
    <tr>
    <td>
    <iframe id="fileframe" runat="server"></iframe>
    </td>
    </tr>
    <tr>
    <td>
    <asp:ListBox runat="server" ID="LstFile" Width="200px"></asp:ListBox>
    </td>
    </tr>
    </table>
    </ContentTemplate>
    </asp:UpdatePanel>
    <%--<asp:LinkButton OnClick ="getfilename()" ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>--%>
    <%--<a onclick="getfilename()" runat="server" >12</a>--%>
    <%--<asp:Button ID="btn" OnClientClick="getfilename" runat="server" Text="1" />--%>
    </form>
    </body>

    </html>

  • #214014
    Imports System
    Imports System.Collections
    Imports System.ComponentModel
    Imports System.Web
    Imports System.Web.UI.WebControls
    Imports System.IO
    Imports System.Text
    Imports System.Web.SessionState
    Imports System.Resources
    Imports System.Globalization
    Imports System.Collections.Specialized
    Imports System.Data
    Imports System.Data.OleDb
    Imports smt
    Imports smt.Utility
    Imports System.IO.StreamWriter
    Imports io


    Namespace smt.T_FileMerge
    Partial Class FileMergePage
    Inherits System.Web.UI.Page
    Dim _Utility As New Utility
    Public Shared dvs As New DataView
    Public Shared searchstring As String
    Public Shared sessionno As Integer
    Public Shared taskid As String
    Public Shared levelid As String
    Public Shared tasklevelval As String
    Dim _fs As New FileSystem
    Public Shared sortcolumndirval As String
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
    lblHeader.Text = _Utility.getPageHeader("filemerge")
    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    _Utility.setStyle(Styler, link)

    If Not IsPostBack Then
    RefreshG()
    End If
    _Utility.setGridStyle(Grid1)
    'Dim NewButtonControl As New HtmlButton()
    'NewButtonControl.ID = "buttion"
    'NewButtonControl.InnerHtml = "Click Me"
    'AddHandler NewButtonControl.ServerClick, AddressOf Button_Click
    'Controls.Add(NewButtonControl)
    If Session(taskid) = taskid Then
    getfilename()
    End If

    'If Session("Add") = 2 Then
    ' Session.Remove("Add")
    ' 'Dim taskid As String = ""
    ' 'Session("taskid") = taskid
    ' 'Dim levelid As String = ""
    ' 'Session("levelid") = levelid
    ' 'fileframe.Visible = True

    ' getfilename()
    'Else
    ' 'fileframe.Visible = False
    'End If
    End Sub
    Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim k As String = sender.ToString()

    ' Display a simple message.
    LstFile.Items.Add("Thank you for clicking the button.")

    End Sub

    Private Function RefreshG()
    Grid1.DataSource = getGridData()
    Grid1.DataBind()
    Grid1.Columns(1).ItemStyle.Width = Unit.Percentage(50)
    End Function

    Private Function getGridData() As DataTable
    Dim dt As New DataTable
    Dim sqlStr As String = "select c.* from (select file_id, file_name,to_char(file_length,'HH:MI:SS') as file_length from th_file where (merge_status is null or not merge_status)and uploaded_time is null) as c join (select main_file_id from th_taskfile group by main_file_id having count (*) > 1) as b on (c.file_id= b.main_file_id)"
    Dim ds As DataSet = _Utility.runsql(sqlStr)
    dt = ds.Tables(0)
    Return dt
    End Function

    Protected Sub Grid1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles Grid1.PageIndexChanging
    Grid1.PageIndex = e.NewPageIndex
    RefreshG()
    End Sub

    Protected Sub Grid1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles Grid1.RowDataBound
    If (e.Row.RowType = DataControlRowType.DataRow) Then
    e.Row.Attributes("onmouseover") = "javascript:setMouseOverColor(this);"
    e.Row.Attributes("onmouseout") = "javascript:setMouseOutColor(this);"
    e.Row.Attributes.Add("onclick", ClientScript.GetPostBackClientHyperlink(Me.Grid1, "Select$" + e.Row.RowIndex.ToString))
    End If
    End Sub

    Protected Sub Grid1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Grid1.SelectedIndexChanged
    eID.Value = Grid1.DataKeys(Grid1.SelectedIndex).Item(0).ToString
    RefreshGridView()
    End Sub


    Private Function RefreshGridView1()


    Dim row As Integer = 0
    ' Generate rows and cells.
    'Dim numrows As Integer = Convert.ToInt32(Select1.Value)
    Dim numrows As Integer = 5
    Dim numcells As Integer = 5
    tabfile.CellPadding = "5"
    tabfile.Width = "100%"
    tabfile.Border = 1
    Dim j As Integer
    For j = 0 To numrows - 1
    Dim r As New HtmlTableRow()
    ' Set bgcolor on alternating rows.
    If row Mod 2 = 1 Then
    r.BgColor = "Gainsboro"
    End If
    row += 1
    Dim i As Integer
    For i = 0 To numcells - 1
    Dim c As New HtmlTableCell()
    'c.Controls.Add(New LiteralControl("row " & j.ToString() & _
    ' ", cell " & i.ToString()))
    'c.Controls.Add(New LiteralControl("<button onserverclick='Delete(" & i & ")' runat='server' type='button'>" & i + 1 & "</button>"))
    Dim NewButtonControl As New HtmlButton()
    AddHandler NewButtonControl.ServerClick, AddressOf Button_Click
    NewButtonControl.ID = j & i + 1
    NewButtonControl.InnerHtml = j & i + 1
    'Session.Add("innertextbutiton", NewButtonControl.ID)

    c.Controls.Add(NewButtonControl)
    r.Cells.Add(c)

    'AddHandler NewButtonControl.Load, AddressOf Button_Click
    Next i
    tabfile.Rows.Add(r)
    Next j
    End Function
    Function Delete(ByVal iItemRow As Integer)

    End Function

    Private Function RefreshGridView11()
    'Dim DTItems As DataSet = getCurrentTasklevel(eID.Value)
    ''Dim str As String = ""
    'Dim BtnFile As New Button
    'Dim strLevelHeader As String = _fs.getLevelHeader()
    'Dim lCount As Integer = _Utility.sqlScalar("select count(level_id) from m_level")
    'Dim bCheck As Boolean = True
    'Dim cell As New HtmlTableCell
    'Dim row As New HtmlTableRow()

    'Dim iItemRow As Integer
    'Dim iItemCell As Integer
    '' Dim newtable As New HtmlTable
    'tabfile.Rows.Clear()
    'For iItemRow = 0 To DTItems.Tables(0).Rows.Count - 1

    ' For iItemCell = 0 To DTItems.Tables(0).Columns.Count
    ' If iItemCell = 0 Then
    ' bCheck = False
    ' 'row.Cells.Add(cell)
    ' 'Dim _tstatus As New TaskStatus(ds.Tables(0).Rows(iItemCell).Item("task_file_id"), ds.Tables(0).Rows(iItemCell).Item("level_id"), "border")
    ' cell.InnerText() = DTItems.Tables(0).Rows(iItemRow).Item(0)

    ' ',ds.Tables(0).Rows(iItemCell).Item("level_id"), "border"
    ' End If
    ' If bCheck = True Then
    ' cell.InnerText() = DTItems.Tables(0).Rows(iItemRow).Item(iItemCell - 1)
    ' row.Cells.Add(cell)
    ' tabfile.Rows.Add(row)
    ' End If
    ' row.Cells.Add(cell)
    ' bCheck = True
    ' Next
    ' 'Dim NewButtonControl As New HtmlButton()
    ' 'NewButtonControl.ID = "new"
    ' 'NewButtonControl.InnerHtml = "Click Me"
    ' 'AddHandler NewButtonControl.ServerClick, AddressOf Button_Click
    ' 'Controls.Add(NewButtonControl)
    ' 'cell.InnerHtml = "<button onserverclick='Delete(" & iItemRow & ")' runat='server' type='button'>" & iItemRow + 1 & "</button>"
    ' 'cell.InnerHtml = row.InnerText
    ' 'row.Cells.Add(cell)
    ' tabfile.Rows.Add(row)
    ' 'newtable.Rows.Add(cell)

    'Next
    End Function

    Private Function RefreshGridView()
    Dim ds As DataSet = getCurrentTasklevel(eID.Value)
    Dim str As String = ""
    Dim BtnFile As New Button
    Dim strLevelHeader As String = _fs.getLevelHeader()
    Dim lCount As Integer = _Utility.sqlScalar("select count(level_id) from m_level")
    str += "<table style=""width:100%"" cellpadding=5 cellspacing=0 id=table1>"
    str += "<tr class=bRowstyle>"
    str += "<th rowspan=2 >S.No</th>"
    str += "<th rowspan=2 >Task File ID</th>"
    str += "<th rowspan=2 >Part No</th>"
    str += "<th rowspan=2 >Start Time</th>"
    str += "<th rowspan=2 >End Time</th>"
    'str += "<th rowspan=2 >Alloted Level</th>"
    str += "<th colspan=" & lCount & " >Status</th>"
    str += "<th rowspan=2 >Status</th>"
    ' str += "<th rowspan=2 >Link</th>"
    str += "</tr>"

    str += "<tr class=bRowstyle>"
    str += strLevelHeader
    str += "</tr>"

    If ds.Tables(0).Rows.Count = 0 Then
    str += "<tr><td style=""text-align:center"" colspan=50>"
    str += "No files available for work"
    str += "</td></tr>"
    End If
    Dim i As Integer
    For i = 0 To ds.Tables(0).Rows.Count - 1
    Dim _tstatus As New TaskStatus(ds.Tables(0).Rows(i).Item("task_file_id"), ds.Tables(0).Rows(i).Item("level_id"), "border")
    Dim strStatus As String = _tstatus.HtmlString
    str += "<tr class=border>"
    str += "<td class=border><input type=""submit"" id=" & (i + 1).ToString & " OnServerClick=""getfilename()?task_file_id=" & ds.Tables(0).Rows(i).Item("task_file_id") & "&level_id=" & ds.Tables(0).Rows(i).Item("level_id") & " id=""btnfile"" runat=""server"" value= " & (i + 1).ToString & " > </td>"

    'Dim NewButtonControl As New HtmlButton()
    'NewButtonControl.ID = (i + 1).ToString

    'Controls.Add(NewButtonControl)

    ' str += "<td class=border id=a1></td>"
    'str += "<td class=border><button language=""javascript"" onclick=""__doPostBack('" & NewButtonControl.ID & "','')"" id=" & NewButtonControl.ID & ">Click Me</button></td>"
    'NewButtonControl.InnerHtml = NewButtonControl.ID
    'AddHandler NewButtonControl.ServerClick, AddressOf Button_Click

    'str += "<td class=border><input type=""submit"" onClick=""getfilename();"" id=""btn"" runat=""server"" value= " & (i + 1).ToString & " > </td>"

    If _tstatus.workAllowed Then
    If Not _tstatus.LevelCrossed Then
    ' str += "<td class=border><a href=fileoperation.aspx?main_file_id=" & ds.Tables(0).Rows(i).Item("file_id") & "&task_file_id=" & ds.Tables(0).Rows(i).Item("task_file_id") & "&level_id=" & ds.Tables(0).Rows(i).Item("level_id") & "&dictator_id=" & ds.Tables(0).Rows(i).Item("dictator_id") & ">" & ds.Tables(0).Rows(i).Item("file_name") & " </a></td>"
    Else
    'str += "<td class=border><a href=fileMergeList.aspx?task_file_id=" & ds.Tables(0).Rows(i).Item("task_file_id") & "&level_id=" & ds.Tables(0).Rows(i).Item("level_id") & "> " & (i + 1).ToString & " </a></td>"
    'str += "<td class=border><a href=?task_file_id=" & ds.Tables(0).Rows(i).Item("task_file_id") & "&level_id=" & ds.Tables(0).Rows(i).Item("level_id") & "> " & (i + 1).ToString & " </a></td>"
    Dim sessionno As Integer = i + 1
    taskid = ds.Tables(0).Rows(i).Item("task_file_id")
    'Request.QueryString.Item(i).Insert(i, taskid)
    'Session.Add("taskid", taskid)
    levelid = ds.Tables(0).Rows(i).Item("level_id")
    Session.Add(taskid, taskid)
    'Session.Add(sessionno, tasklevelval)
    'Session.Add("levelid", taskid)
    End If
    Else
    End If
    str += "<td class=border> " & ds.Tables(0).Rows(i).Item("task_file_id") & "</td>"
    str += "<td class=border>" & ds.Tables(0).Rows(i).Item("part_no") & "</td>"
    str += "<td class=border>" + ds.Tables(0).Rows(i).Item("start_time") + "</td>"
    str += "<td class=border>" + ds.Tables(0).Rows(i).Item("end_time") + "</td>"
    str += strStatus
    str += "<td class=border>" & ds.Tables(0).Rows(i).Item("completed") & "</td>"
    str += "</tr>"
    Next
    str += "</table>"
    divTable.InnerHtml = str
    For Each Con As Control In divTable.Controls

    Dim k As Control = Con
    Next

    ''Dim HtmlTable As HtmlTable = divTable.Controls().
    'Dim NewButtonControl As New HtmlButton()
    'NewButtonControl.ID = "aaaa"
    'NewButtonControl.InnerHtml = NewButtonControl.ID
    'AddHandler NewButtonControl.ServerClick, AddressOf Button_Click
    'Dim a = tabfile.Rows(0).Cells(0)
    End Function

    Protected Function getfilename()
    'Protected Function getfilename(ByVal sender As Object, ByVal e As EventArgs)
    Dim tfID As String = taskid
    Dim lID As String = levelid
    'Dim i As Integer
    'Dim k2 As String = Request.QueryString.Item(i)



    ''Dim k As String = Session("Sessno")
    'If Session("Sessno") = taskid Then
    ' Dim k1 As Integer = Session.Count
    'tasklevelval = Session.Item(5)
    'Dim tfID As String = taskid
    'Dim lID As String = Session("levelid")
    If Not tfID = "" And Not lID = "" Then
    Dim k As String = _fs.getTaskFilePath(tfID, lID, "false")
    Dim dir As DirectoryInfo = New DirectoryInfo(k)
    Dim fsi As FileSystemInfo
    For Each fsi In dir.GetFileSystemInfos()
    Try
    Dim d As FileInfo = CType(fsi, FileInfo)
    Dim fileName As String = d.Name.ToString
    LstFile.Items.Add(fileName)
    Catch Es As Exception
    End Try
    Next
    End If

    'Session.Remove("Sessno", 3)

    ' End If



    End Function


    'Private Function getfilename()

    ' Dim tfID As String = Request.QueryString("task_file_id")
    ' Dim lID As String = Request.QueryString("level_id")
    ' Dim k As String = _fs.getTaskFilePath(tfID, lID, "false")
    ' Dim dir As DirectoryInfo = New DirectoryInfo(k)
    ' Dim fsi As FileSystemInfo
    ' For Each fsi In dir.GetFileSystemInfos()
    ' Try
    ' Dim d As FileInfo = CType(fsi, FileInfo)
    ' Dim fileName As String = d.Name.ToString
    ' LstFile.Items.Add(fileName)
    ' Catch Es As Exception
    ' End Try
    ' Next
    'End Function

    Public Function getCurrentTasklevel(ByVal main_file_id As Long) As DataSet
    Dim strWhere As String = ""
    If Not main_file_id = Nothing Then
    strWhere = " and tf.main_file_id = " & _Utility.ToSql(main_file_id, FieldType.Integer_) & " "
    End If
    'Return _utility.runsql("SELECT file_id , f.file_name , to_char(file_length,'HH24:MI:SS') as file_length, l.level_name , to_char(tf.part_start_time,'HH24:MI:SS') as start_time, to_char(tf.part_end_time,'HH24:MI:SS') as end_time, client_name , dictator_name , tf.task_file_id ,f.has_split,l.level_id,d.dictator_id FROM th_file as f, th_taskfile as tf, th_taskallotment as ta, m_level as l, m_client as c, m_dictator as d WHERE tf.main_file_id = f.file_id and ta.task_file_id = tf.task_file_id and ta.level_id = l.level_id and d.client_id = c.client_id and d.dictator_id = f.dictator_id and f.deleted = false and ta.allotment_date = current_date and ta.emp_id = " + _utility.ToSql(Current.Session("user_id"), FieldType.Integer_) & strWhere)
    Return _Utility.runsql("SELECT tf.task_file_id, tf.part_no , to_char(tf.part_start_time,'HH24:MI:SS') as start_time, to_char(tf.part_end_time,'HH24:MI:SS') as end_time ,l.level_name , l.level_id ,tf.completed FROM th_file as f, th_taskfile as tf, th_taskallotment as ta, m_level as l, m_client as c, m_dictator as d WHERE tf.main_file_id = f.file_id and ta.task_file_id = tf.task_file_id and ta.level_id = l.level_id and d.client_id = c.client_id and d.dictator_id = f.dictator_id and f.deleted = false " & strWhere)
    End Function

    End Class
    End Namespace


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.