insert function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • choonmui
    New Member
    • Jul 2007
    • 7

    insert function

    hello.. i am new here and need some help in vb.net!!

    i need to do an insert function.. for example: there are some checkboxes. if the box is checked and a user clicks the button 'select', the item that had been checked will show up in other page.
    the problem is i don know how to retrive data from database once user click the button 'select'

    thats all, thank you!!
  • WebNewbie
    New Member
    • Jul 2007
    • 15

    #2
    Hi, try the link below, it is written in C# . If you want to convert it to VB.NET go to the link below it. Hope that helps.



    Convert C# to VB.NET

    Comment

    • choonmui
      New Member
      • Jul 2007
      • 7

      #3
      thanks for the reply..

      i need to show the checked item on the other page. the item selected is retrieve from database.
      the problem is i don know how to pass the checked item to other page and how to retrive from database as well..

      pls help, urgent!!

      Comment

      • WebNewbie
        New Member
        • Jul 2007
        • 15

        #4
        If your still interested in having your problem solved PM.

        Comment

        • choonmui
          New Member
          • Jul 2007
          • 7

          #5
          grid

          help me..... urgent!!

          how to call checkbox in the grid and post the checked box value to other page??

          Comment

          • vee10
            New Member
            • Oct 2006
            • 141

            #6
            Originally posted by choonmui
            help me..... urgent!!

            how to call checkbox in the grid and post the checked box value to other page??

            hi

            this below code may solve ur problem
            Code:
             <asp:GridView ID="GridView1" runat="server" Font-Italic="True" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
                        <Columns>
                        <asp:TemplateField HeaderText="Select">
                       <HeaderStyle HorizontalAlign="Center" />
                       <ItemStyle HorizontalAlign="center" />
                       <ItemTemplate>
                       <asp:CheckBox runat="server" ID="chkSelect" Checked='False' />
                       </ItemTemplate>           
                        </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
            javascript to read the checkbox value

            alert(document. getElementById( "GridView1_ctl0 2_chkSelect").c hecked);

            and if next row u want the checkboxvalue
            then "GridView1_ctl0 3_chkSelect" and soon increment the integer value until the last row

            Now u want to pass the value to other page then place it in cookie

            document.cookie ="checkboxVa lue = " + document.getEle mentById("GridV iew1_ctl02_chkS elect").checked ;
            then
            in that page when loading the page retrieve the cookie value for the above

            Code:
             
            <html >
            <head runat="server">
                <title>Untitled Page</title>
                <script type="text/javascript">
                function insertValue()
                {
                debugger
                if(document.cookie.indexOf("checkboxValue=") != -1)
                {
                
                document.getElementById("textBox").value =document.cookie.substring(document.cookie.indexOf("=")+1);
                }
                }
                </script>
            </head>
            <body  onload = "return insertValue();">
                <form id="form1" runat="server">
                <div>
                <input type = "text" id ="textBox"/>
                </div>
                </form>
            </body>
            </html>
            if u want to know more about the checkbox retrieving and cookies refer to this references

            http://www.thescarms.c om/dotnet/webdatagrid.asp x
            http://echoecho.com/jscookies02.htm

            Comment

            • choonmui
              New Member
              • Jul 2007
              • 7

              #7
              thanks for the reply. but i am still blur about it.

              i put the code to the page below in the page that use by user to check the box name 'order.aspx'

              Code: ( text )
              <asp:datagrid ID="Grid" runat="server" Font-Italic="True" OnSelectedIndex Changed="Grid_S electedIndexCha nged">
              <Columns>
              <asp:TemplateFi eld HeaderText="Sel ect">
              <HeaderStyle HorizontalAlign ="Center" />
              <ItemStyle HorizontalAlign ="center" />
              <ItemTemplate >
              <asp:CheckBox runat="server" ID="Checkbox2" Checked='False' />
              </ItemTemplate>
              </asp:TemplateFie ld>
              </Columns>
              </asp:GridView>

              then in the page of retrive data named 'showOder.aspx' :

              Code:
              function insertValue()
              {
              debugger
              if(document.coo kie.indexOf("ch eckboxValue") != -1)
              {
              document.getEle mentById("DataG rid1").value =document.cooki e.substring (document.cooki e.indexOf ("=")+1);
              alert(document. getElementById( "Grid_ctl02_Che ckbox2").checke d);
              document.cookie ="checkboxValue ="+document.get ElementByld("Gr id_ctl01_Checkb ox2").checked;
              self.closed();
              }
              }

              i try with selecting one checked box only.Am i doing wrong on this? Because i still can not get the data when i click the button select.

              Comment

              Working...