Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Oracle VB.NET
<div id="mydiv"  runat="server">
 <style type="text/css" media="all">
 

table.second
{
    margin: 0;
    padding: 0;
    position: relative;
    top: 5px;
    left: 70px;
 

}
</style>
Protected Function doPageLoad(ByVal sender As Object, _
                                 ByVal e As System.EventArgs _
                                ) As IMaCSRetVal
 
       If Page.IsPostBack = False Then
           BindGridview()
           For dp As Integer = 1 To 10
               ddlst_Scale_pointers.Items.Add(dp)
           Next
       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("<tr>")
     sb.Append("<td>Pointer No</td>")
     sb.Append("<td>Pointer Label</td>")
     sb.Append("<td>Pointer Color</td>")
     sb.Append("</tr>")
     For i As Integer = 1 To ddlst_Scale_pointers.SelectedItem.Value
         sb.Append("<tr>")
         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> ")
     Next
     sb.Append("</table>")
     sb.Append("</center>")
     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
Edited 14-Feb-13 17:44pm
v4
Comments
CHill60 at 14-Feb-13 6:38am
   
You've forgotten to add any explanation or a question
Asim Mahmood at 14-Feb-13 7:18am
   
Please add your question here.
ryanb31 at 14-Feb-13 8:46am
   
What do you need help with?
Member 9410081 at 15-Feb-13 0:41am
   
i have updaed the question can any1 help urgentlly
Rate this: bad
good
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.
  Permalink  
Comments
Member 9410081 at 15-Feb-13 4:50am
   
Thanks
 
can you give the codes as i am not getting
Rate this: bad
good
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='';
      if(tbl.rows.length>1)
      {
       for(var RowCnt=1;RowCnt1)
      {
       result=result.substring(1);
      }
      hiddenField.value=result;
      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
             }
        }
    }
  Permalink  
Comments
Member 9410081 at 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 at 17-Feb-13 23:55pm
   
Did you add Hiddenfield in your page?
Member 9410081 at 18-Feb-13 5:16am
   
yes

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



Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 15 Feb 2013
Copyright © CodeProject, 1999-2014
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