|
Radha27 wrote: Did i miss anything here?
Did you add the table inside the page ?
|
|
|
|
|
Yes, i do.
Table tblData = new Table();
TableRow r = new TableRow();
TableCell c1 = new TableCell();
...
c1.Controls.Add(Text1[i]);
r.Cells.Add(c1);
tblData.Rows.Add(r);
Thanks & Regards,
Radha
|
|
|
|
|
where did you added the Table into page????
use
this.Control.Add(tblData);
if still problem let me know or if you solve then also inform me !!!!
|
|
|
|
|
Sorry i have a panel and add that table to panel.
Panel1.Controls.Add(tblData);
But still it doesn't work.
Thanks & Regards,
Radha
|
|
|
|
|
ok, then wait for few minutes,,,, and let me do this ....!!!!
|
|
|
|
|
Thanks a lot.
Thanks & Regards,
Radha
|
|
|
|
|
In Designed View Dragged and Drop a ASP.NET TAble Control From ToolBox
-----
Changed The ID : tblRunTime
--------------
Copy this code to page load !!!!
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
<br />
for ( int i = 0; i < 10; i++ ) <br />
{ TableRow tr = new TableRow(); <br />
TableCell td1 = new TableCell(); <br />
DropDownList _dr = new DropDownList();<br />
_dr.ID = "lbl" + i.ToString();<br />
_dr.Items.Add("DropDownList " + i.ToString()); <br />
td1.Controls.Add(_dr); <br />
TableCell td2 = new TableCell(); <br />
TextBox _text = new TextBox(); <br />
_text.ID = "TextBox " + i.ToString(); <br />
td2.Controls.Add(_text); <br />
tr.Cells.Add(td1); <br />
tr.Cells.Add(td2);<br />
tblRunTime.Rows.Add(tr);<br />
}<br />
}
---
Run It..........
------
--------
Check my latest Article in codeproject !!!!
Let me know when done !!!!
|
|
|
|
|
Hope this is now working for you !!!
|
|
|
|
|
Thanks a lot.
Its working now.
Thanks & Regards,
Radha
|
|
|
|
|
|
Sorry I am very much new to .Net.. still i have doubt in this.. How can i insert those to Database.. i mean directly using loop or in some other way, as it is not compulsary to add values for all those 10 records.. In case if i enter values for only 2 records how can i retrieve those? Please help me..
Thanks & Regards,
Radha
|
|
|
|
|
just read reocrds on Datareader , now
while(datareader!=null)
{
_dr.items.Add(datareadr[index].text);
}
This is a concept , you can try this,
|
|
|
|
|
Thanks Abhijit, But i did like this.
_dr.DataSource = GetData();
...
public DataSet GetData()
{
...
}
What i asked is.. when i click Submit button, all the 10 rows are inserted even if i enter Data only for 2 rows. I am inserting records based on the table rows count.
protected void btnSubmit_Click(object sender, EventArgs e)
{
int j = tblRunTime.Rows.Count;
for (int c = 0; c < j; c++)
{
string query = " INSERT INTO Time VALUES( ";
query = query + " '" + Request.Form["_dr1" + c.ToString()] + "', ";
query = query + " '" + Request.Form["_dr2" + c.ToString()] + "', ";
query = query + " '" + Request.Form["text1" + c.ToString()] + "', ";
...
query = query + " '" + Request.Form["text8" + c.ToString()] + "', ";
query = query + " '" + f_date_b.Value + "'";
query = query + " )";
}
So, how i can solve this?
Please help me.
Thanks & Regards,
Radha
|
|
|
|
|
Let me know if you have still any problem !!! i will check on this on tomorrow!!!
Good night !!!
|
|
|
|
|
create a table at runtime add rows into it and afterwards add the controls into the cells.
similarly u can do the same to create the single or more then one rows at run time.
all u have to do is to find the table id at runtime.
Hope this will help u.
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Yup, this is also a greate idea !!!
|
|
|
|
|
Thank u Pankaj.
I tried this. Even, one row is loaded by default. and if i click to add a new row, a new row is added but first row disappears.
ddlActivity.ID = "ddlActivity" + i;
ddlActivity.Visible = true;
...
Text1.ID = "Text1" + i;
Text1.Visible = true;
Text1.Width = 40;
...
Table tblForm = new Table();
tblForm.ID = "tblform";
TableRow r = new TableRow();
r.ID = "r" + i;
TableCell c8 = new TableCell();
TableCell c9 = new TableCell();
TableCell c = new TableCell();
TableCell c1 = new TableCell();
TableCell c2 = new TableCell();
TableCell c3 = new TableCell();
TableCell c4 = new TableCell();
TableCell c5 = new TableCell();
TableCell c6 = new TableCell();
TableCell c7 = new TableCell();
c8.Controls.Add(ddl1);
r.Cells.Add(c8);
c9.Controls.Add(ddl2);
r.Cells.Add(c9);
c.Controls.Add(Text1);
r.Cells.Add(c);
c1.Controls.Add(Text2);
r.Cells.Add(c1);
c2.Controls.Add(Text3);
r.Cells.Add(c2);
c3.Controls.Add(Text4);
r.Cells.Add(c3);
c4.Controls.Add(Text5);
r.Cells.Add(c4);
c5.Controls.Add(Text6);
r.Cells.Add(c5);
c6.Controls.Add(Text7);
r.Cells.Add(c6);
c7.Controls.Add(Text8);
r.Cells.Add(c7);
tblForm.Rows.Add(r);
plh.Controls.Add(tblForm);
I added controls like this. Did i miss anything here??
Thanks & Regards,
Radha
|
|
|
|
|
If u r adding the table dynamically , then keep in mind that the memory of that table control is not being washed out(I mean use the access modifier for the table control at the class level.)
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Hi all
I have 2 Datatable
the fist (dtUser): have column UserID, Name, Address (10 rows)
the second(dtOrder): have column OrderID, UserID (5)
And 2 datatable haven't relationship
How can i "Select * from dtOrder A LEFT JOIN dtUser B ON A.UserID = B.UserID" in new datatable by Asp.net ??
|
|
|
|
|
Your question has nothing to do with ASP.NET.
However, you can define parent/child relationships between DataTables by using the DataRelation[^] class.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
SELECT *
FROM dbo.dtOrder INNER JOIN
dbo.dtuser ON dbo.dtOrder.UserID = dbo.dtuser.UserID
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Hi,
I can't find a tutorial how to make server controls (if that is what I need to learn?).....
I want a control, which I can use on several projects (I can drag'n'drop from the toolbox).
The control I want, shoul be a web-based admin tool (to update users, delete users, create groups and so on) to the login control....
I tried for the past few days to look after such a control....but couldn't find it so now I want to build my own.....
But now I need a tutorial that explains me how to make such a control. Can anybody please help me?
Kind regards,
simsen
|
|
|
|
|
Try to use Web Control ...(ascx File)...
|
|
|
|
|
Hi Abhijit,
Thanks for answering me
I don't know anything in creating controls only to use them......
Is a Web Control a user control (I have read that to use user controls in several solutions I have to implement the hole code in each solutions - this I don't want to do, I want a control which I can drag'n'drop from my toolbox whatever solution I am using)?
If I can this with a web control - do you have any links to an tutorial where it shows how to......witch database functionality?
Kind regards,
simsen
|
|
|
|
|
Just tell me what type of control do you want to create ?
|
|
|
|