Click here to Skip to main content
13,152,321 members (42,884 online)
Rate this:
Please Sign up or sign in to vote.
See more:
<div id="mydiv"  runat="server">
 <style type="text/css" media="all">

    margin: 0;
    padding: 0;
    position: relative;
    top: 5px;
    left: 70px;


Protected Function doPageLoad(ByVal sender As Object, _
                                 ByVal e As System.EventArgs _
                                ) As IMaCSRetVal
       If Page.IsPostBack = False Then
           For dp As Integer = 1 To 10
       End If

Protected Sub ddlst_Scale_pointers_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlst_Scale_pointers.SelectedIndexChanged
     Dim sb As New StringBuilder()
     sb.Append("<table width='400' class='second'  border='1px'>")
     sb.Append("<td>Pointer No</td>")
     sb.Append("<td>Pointer Label</td>")
     sb.Append("<td>Pointer Color</td>")
     For i As Integer = 1 To ddlst_Scale_pointers.SelectedItem.Value
         sb.Append("<td>" & i & "</td>")
         sb.Append("<td><input id='txtlbl" & i & "'  type='text' /></td>")
         sb.Append("<td><input id='txtcolour" & i & "' class='color' type='text' /></td>")
         sb.Append("</tr> ")
     mydiv.InnerHtml = sb.ToString()
 End Sub.

how can i fetch the values fom above table into hidden feild so that i can strore them to database?

how can i store values to database from above table?
Posted 14-Feb-13 0:34am
Updated 14-Feb-13 17:44pm
CHill60 14-Feb-13 6:38am
You've forgotten to add any explanation or a question
Asim Mahmood 14-Feb-13 7:18am
Please add your question here.
ryanb31 14-Feb-13 8:46am
What do you need help with?
Member 9410081 15-Feb-13 0:41am
i have updaed the question can any1 help urgentlly
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

=>First assign the "ID" field to table.
=>Call javascript fucntion before saving data to database to insert table rows into hiddenfields.
=>Start from second row of table,find each control in row, insert value of this control into hiddenfield separated by special character.
=>Once one row is insert into hiddenfield again insert another special character which indicates starting of the another row.

thus all the values will be insert into one hiddenfiled ,it will also help you separate each row,each value from heddenfield to insert into database.
Member 9410081 15-Feb-13 4:50am

can you give the codes as i am not getting
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

function  FillHidn()
     var tbl=document.getElementById('myTable');//ID of table which you have given.
     var hiddenField=document.getElementById('<%=myHidden.ClientID %>');//hiddenfield.
     var result='';
      for(var RowCnt=1;RowCnt1)
     return true;

<asp:HiddenField ID="myHidden" runat="server" />
<asp:Button ID="Button1" runat="server" Text="save" OnClientClick="return FillHidn();" OnClick="Button1_Click" />

protected void Button1_Click(object sender, EventArgs e)
        if (myHidden.Value.Length &gt; 0)
             string[] RowArr=myHidden.Value.Split('^');
             foreach (string obj in RowArr)
                 string[] Cntrls = obj.Split('~');
                 //You can use this code to insert the rows into databse.
                 //Cntrls[0] First Cloumn of the table
                 //Cntrls[1] Second Cloumn of the table
                 //Cntrls[2] Third Cloumn of the table
Member 9410081 16-Feb-13 1:32am
giving error in this place

if (myHidden.Value.Length > 0)

gt is not defined in current context

Actually i dnt have any button clk on wich the hidden feild shuld filled

but i have a table created dynamically as i cannot fill this data dynamically into database i am trying store in hidden field so that the data from hidden feild can be stored into database.
Hrushikesh_phapale 17-Feb-13 23:55pm
Did you add Hiddenfield in your page?
Member 9410081 18-Feb-13 5:16am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170924.2 | Last Updated 15 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100