Click here to Skip to main content
15,896,063 members

how to pass values from gridview to popup window (update)

musiw asked:

Open original thread
hi guys,

please help me on this..

last 2 weeks i already success to update value from gridview using popup window..but i notice when i edit on aspx page which is to make the gridview fix layout, the process to pass the value to popup window didnt work it.

the value isnt displayed there..if i use asp:boundfield the value from gview is displayed, but if i use asp:templatefield no value displayed on popup window..........but asp:templatefield is important as if user enter long string i want to break word

currently only date is displayed on popup window, else blank..i need to finish this today.please help me..

thanks in advance
musiw.

--code behind--
VB
Protected Sub Close_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim row As GridViewRow = CType(CType(sender, LinkButton).Parent.Parent, GridViewRow)
        
        Label1.Text = row.Cells(1).Text
        lbltask.Text = row.Cells(2).Text
        lblpic.Text = row.Cells(3).Text
        lblstart.Text = row.Cells(4).Text 
        lbldue.Text = row.Cells(5).Text
        TextBox1.Text = row.Cells(6).Text
        

        Me.OfficePopup1.Show()
    End Sub


--aspx page--
ASP.NET
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                    AutoGenerateColumns="False"  
                    Font-Names="Arial" HeaderStyle-ForeColor="Black" 
                    
                    ShowFooter="True" Font-Size="9" Width="100%" DataKeyNames="id" OnRowDataBound="GridView1_RowDataBound" OnPageIndexChanging="GridView1_PageIndexChanging">
                    <columns>
                        <asp:TemplateField HeaderText="">
                        <itemtemplate>
                            <asp:LinkButton ID="LinkButton1" ItemStyle-Width="70px" ItemStyle-Height="50px" runat="server" Text="Close?" OnClick="Close_Click">
                                                
                        </itemtemplate>
                        
                        <asp:BoundField HeaderText="Task ID" ReadOnly="true" DataField="id" ItemStyle-Width="70px" ItemStyle-Height="50px"/>
                           <asp:TemplateField HeaderText="Task" ItemStyle-Width="300px" ItemStyle-Height="50px">
       <itemtemplate>
       <div style="word-wrap: break-word; width: 300px; height: 50px; overflow:auto;">
            <%# Eval("title_task")%></div>
       </itemtemplate>
       
                           <asp:TemplateField HeaderText="PIC" ItemStyle-Width="250px" ItemStyle-Height="50px">
       <itemtemplate>
       <div style="word-wrap: break-word; width: 250px; height: 50px; overflow:auto;">
            <%# Eval("pic")%></div>
       </itemtemplate>
       
                            <asp:BoundField HeaderText="Start Date" ReadOnly="true" DataField="mula" ItemStyle-Width="70px" ItemStyle-Height="50px"/>
                            <asp:BoundField HeaderText="Due Date" ReadOnly="true" DataField="tamat" ItemStyle-Width="70px" ItemStyle-Height="50px"/>
                            <asp:TemplateField HeaderText="Status/Remarks" ItemStyle-Width="350px" ItemStyle-Height="50px">
       <itemtemplate>
       <div style="word-wrap: break-word; width: 350px; height: 50px; overflow:auto;">
            <%# Eval("status_remarks")%></div>
       </itemtemplate>
       
                            <asp:BoundField HeaderText="Indicator" ReadOnly="true" DataField="indicator" ItemStyle-Width="100px" ItemStyle-Height="50px"/>
                    </columns>
                    <emptydatatemplate>
        No Record Found
        </emptydatatemplate>
                
                
    <asp:Label ID="Label1" runat="server" Text="" Visible="false">
    <asp:Label ID="Label7" runat="server" Text="" Visible="false">
    <asp:Label ID="Label9" runat="server" Text="" Visible="false">
    <asp:Label ID="Label8" runat="server" Text="" >
    <asp:Button ID="showPop" runat="server" Text="Button" />
    <OfficeWebUI:OfficePopup ID="OfficePopup1"  runat="server"  önClickOk="Update" Title="Closing A Task" Height="300">
    <content>
    <table style="width: 100%;">
            <tr>
                <td>
                    <asp:Label ID="Label2" runat="server" Text="Task:" >
                </td>
                <td>
                    <asp:Label ID="lbltask" runat="server"  >
                </td>
                </tr>
                <tr>
                <td>
                    <asp:Label ID="Label3" runat="server" Text="PIC:" >
                </td>
                <td>
                    <asp:Label ID="lblpic" runat="server" >
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label4" runat="server" Text="Start Date:" Font-Bold="True" Font-Size="9">
                </td>
                <td>
                    <asp:Label ID="lblstart" runat="server" Font-Size="9">
                </td>
                </tr>
                <tr>
                <td>
                    <asp:Label ID="Label5" runat="server" Text="Due Date:" Font-Bold="True" Font-Size="9">
                </td>
                <td>
                    <asp:Label ID="lbldue" runat="server" Font-Size="9">
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label6" runat="server" Text="Reason to Close:" Font-Bold="True" Font-Size="9">
                </td>
                <td>
                    <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Width="250px" Font-Size="9">
                    
                </td>
                </tr>
                <tr>
                <td>
                    
                    <asp:CheckBox ID="CheckBox1" runat="server" Text="COMPLETE" Font-Size="9"/>
                </td>
                
            </tr>
        </table>
    </content>
Tags: Visual Basic, .NET, ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900