Click here to Skip to main content
15,891,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
while inserting the txtUname.text as an argument for the sql command
in place of the web control id(assigned to a array) can we use an array like Uname[index].text in the sql command.

If yet all any one didn't get idea of this question please give me a reply? i'll explain what i want?
Please help me........
Posted
Comments
bad sect0r 14-Oct-11 4:20am    
Can you please describe more, but only exactly what you want to do. I don't understand what are you trying to do, sorry.

Hi,

I write some code for you.check this once

May be this is what you want

ASP.NET
<asp:panel id="Panel1" runat="server" xmlns:asp="#unknown">
    <asp:textbox id="TextBox1" runat="server"></asp:textbox><br />
    <asp:textbox id="TextBox2" runat="server"></asp:textbox><br />
    <asp:textbox id="TextBox3" runat="server"></asp:textbox><br />
    <asp:textbox id="TextBox4" runat="server"></asp:textbox><br />
    <asp:textbox id="TextBox5" runat="server"></asp:textbox><br />
    <asp:textbox id="TextBox6" runat="server"></asp:textbox><br />
</asp:panel>
<br />
<asp:button id="Button1" runat="server" text="Button" onclick="Button1_Click" xmlns:asp="#unknown" />


And code behind file contains following code

C#
    protected void Button1_Click(object sender, EventArgs e)
    {
        List<textbox> txtboxlst = new List<textbox>();
        foreach (Control c in Panel1.Controls)
        {
            if (c is TextBox)
            {
                txtboxlst.Add((TextBox )c);
            }
        }
        string str1 = txtboxlst[0].Text;
    }
</textbox></textbox>



Now tell me what exactly you want

All the Best
 
Share this answer
 
Comments
sandhya.T 2011 15-Oct-11 0:34am    
to enter a family details into the database
father:textbox1
mother:textbox2
children details
Name Age qualification
child 1 textbox3 ddlAge1 textbox4
child 2 textbox5 ddlAge2 textbox6

btnsubmit


after clicking on to the button i have to insert the detail of the family for each child as individual records
in data base table

tablename with (5 fields)

FamilyDetails(fathername, mothername, childname, age, qualification)
here in that name age qualification fields can be inserted by using an array for each individual field as CName[2], age[2], qual[2]........
Is it possible?????
if it is possibles please guide me
Muralikrishna8811 15-Oct-11 5:02am    
yeah possible.

just loop that controls which i did in my solution.


Muralikrishna8811 15-Oct-11 5:26am    
if you post your code its easy to solve your problem
Hi,
First Of all take All the details Of Children And Store it in Temp Datatable
Say Dt...
Now You can Access Each cell of dt Accordingly you can store this Details In Respective Database Table
C#
table = (DataTable)Session["Temp_Product_Table"];

                     for (int i = 0; i < table.Rows.Count; i++)
                     {
                         string cmd_Insert_Product_In_Db = "INSERT INTO IWO_Product_List(iwo_no,product,model,price,vat,excise,other_tax,amount) Values('" + table.Rows[i][1] + "','" + table.Rows[i][2] + "','" + table.Rows[i][3] + "','" + table.Rows[i][4] + "','" + table.Rows[i][5] + "','" + table.Rows[i][6] + "','" + table.Rows[i][7] + "','" + table.Rows[i][8] + "')";
                         MIS_DAL.ExecuteNonQuery(cmd_Insert_Product_In_Db, "query");

                     }
 
Share this answer
 
Comments
sandhya.T 2011 18-Oct-11 4:42am    
Thanq so much tushar patil
Its very useful to me
_Tushar Patil 18-Oct-11 5:33am    
Always Wel-Come..........

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



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