Click here to Skip to main content
15,881,697 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: job portal Pin
sashidhar17-Sep-09 0:04
sashidhar17-Sep-09 0:04 
GeneralRe: job portal Pin
sumanmks17-Sep-09 0:09
sumanmks17-Sep-09 0:09 
GeneralRe: job portal Pin
sashidhar17-Sep-09 0:18
sashidhar17-Sep-09 0:18 
GeneralRe: job portal Pin
sumanmks17-Sep-09 0:20
sumanmks17-Sep-09 0:20 
AnswerRe: job portal Pin
Arun Jacob17-Sep-09 0:09
Arun Jacob17-Sep-09 0:09 
GeneralRe: job portal Pin
sumanmks17-Sep-09 0:28
sumanmks17-Sep-09 0:28 
AnswerRe: job portal Pin
Arun Jacob17-Sep-09 0:31
Arun Jacob17-Sep-09 0:31 
Questionadding table to div at runtime.. but when i want to access it using findcontrol method its returning null Pin
shailendra_csp16-Sep-09 23:51
shailendra_csp16-Sep-09 23:51 
Hi all

I am having following code..

#region Dynamically added control to the table <br />
            TableRow tr=null;<br />
            int cols = 0;<br />
            if (multiFile.Files.Length > 0)<br />
            {<br />
                msg.InnerText = "These Files Uploaded Successfully. [" + multiFile.Files.Length + " files]. ";<br />
                int counter=0;<br />
                foreach (UploadedFile file in multiFile.Files)<br />
                {<br />
                    //this for display 5 image in one row <br />
                    if (cols % 5 == 0)<br />
                    {<br />
                        tr = new TableRow();<br />
                    }<br />
                    string FolderPath = Server.MapPath("Images");<br />
                    file.MoveTo(FolderPath + "\\" + file.FileName, MoveToOptions.Overwrite);<br />
<br />
                    Image myImage = new Image();<br />
                    myImage.ImageUrl = "~/Images/" + file.FileName;<br />
                    myImage.Height = 150;<br />
                    myImage.Width =150;<br />
                    //create new inner table so that we can add all fields in sequence<br />
                    Table innerTable = new Table();<br />
                    <br />
                    //create new row and add images<br />
                    TableRow innerTr1 = new TableRow();<br />
                    TableCell innerTc11 = new TableCell();<br />
                    innerTc11.ColumnSpan = 2;<br />
                    innerTc11.Controls.Add(myImage);<br />
<br />
                    innerTr1.Controls.Add(innerTc11);<br />
<br />
                    //create row 2 <br />
                    TableRow innerTr2 = new TableRow();<br />
<br />
                    //create control to add in row 2 and column 1<br />
                    DropDownList ddlEyeType = new DropDownList();<br />
                    ddlEyeType.ID = "ddlEyeType_" + counter.ToString();<br />
                   <br />
                    ddlEyeType.Items.Add(new ListItem("", "-1"));<br />
                    ddlEyeType.Items.Add(new ListItem("Left Eye", "1"));<br />
                    ddlEyeType.Items.Add(new ListItem("Right Eye", "2"));<br />
                    //create column 1 for row 2<br />
                    TableCell innerTc21 = new TableCell();<br />
                    innerTc21.Controls.Add(ddlEyeType);<br />
<br />
                    //create control to add in row 2 and column 2<br />
                    DropDownList ddlEyePart = new DropDownList();<br />
                    ddlEyePart.ID = "ddlEyePart_" + counter.ToString();<br />
                    counter++;<br />
                    ddlEyePart.Items.Add(new ListItem("", "-1"));<br />
                    ddlEyePart.Items.Add(new ListItem("A1R", "0"));<br />
                    ddlEyePart.Items.Add(new ListItem("A1L", "1"));<br />
                    ddlEyePart.Items.Add(new ListItem("A2", "2"));<br />
                    ddlEyePart.Items.Add(new ListItem("A3", "3"));<br />
                    ddlEyePart.Items.Add(new ListItem("A4", "4"));<br />
                    ddlEyePart.Items.Add(new ListItem("A5", "5"));<br />
                    ddlEyePart.Items.Add(new ListItem("Other", "6"));<br />
<br />
                    //create column 2 for row 2 <br />
                    TableCell innerTc22 = new TableCell();<br />
                    innerTc22.Controls.Add(ddlEyePart);<br />
<br />
                    //add both columns to the 2nd row<br />
                    innerTr2.Controls.Add(innerTc21);<br />
                    innerTr2.Controls.Add(innerTc22);<br />
<br />
                    //now add both rows in the table. <br />
                    innerTable.Controls.Add(innerTr1);<br />
                    innerTable.Controls.Add(innerTr2);<br />
<br />
                    //now finaly add inner table to the upper column<br />
                    TableCell tc = new TableCell();<br />
                    tc.Controls.Add(innerTable);<br />
<br />
                    tr.Controls.Add(tc);<br />
<br />
                    if (cols % 5 == 0)<br />
                    {<br />
                        tblUploaded.Rows.Add(tr);<br />
                    }<br />
<br />
                    cols++;<br />
                }<br />
                <br />
            }<br />
            #endregion


Its working perfectly and display all the cells with specified images. The problem is i want to retrieve all cells value on an button click but its returning null..
Is my approach wrong...????

If any one need whole code to fix this problem please let me know..


Thanks a lot..
AnswerRe: adding table to div at runtime.. but when i want to access it using findcontrol method its returning null Pin
Muhammad Mazhar17-Sep-09 9:07
Muhammad Mazhar17-Sep-09 9:07 
QuestionRemove tabindex from custom control Pin
sonalee230416-Sep-09 23:19
sonalee230416-Sep-09 23:19 
AnswerRe: Remove tabindex from custom control Pin
ss_hellhound15-Oct-09 2:04
ss_hellhound15-Oct-09 2:04 
Questionhow to save value in Ms Access using asp.net 2.0 C# Pin
prateekfgiet16-Sep-09 22:59
prateekfgiet16-Sep-09 22:59 
AnswerRe: how to save value in Ms Access using asp.net 2.0 C# Pin
Rajeshwar Code- Developer16-Sep-09 23:33
Rajeshwar Code- Developer16-Sep-09 23:33 
GeneralRe: how to save value in Ms Access using asp.net 2.0 C# Pin
prateekfgiet16-Sep-09 23:41
prateekfgiet16-Sep-09 23:41 
GeneralRe: how to save value in Ms Access using asp.net 2.0 C# Pin
sashidhar16-Sep-09 23:51
sashidhar16-Sep-09 23:51 
AnswerRe: how to save value in Ms Access using asp.net 2.0 C# Pin
Prabhakar Parihar18-Sep-09 22:02
Prabhakar Parihar18-Sep-09 22:02 
AnswerRe: how to save value in Ms Access using asp.net 2.0 C# Pin
Prabhakar Parihar18-Sep-09 22:25
Prabhakar Parihar18-Sep-09 22:25 
Questioncan ajax run if javascript is disabled on client browser Pin
S.Aijaz16-Sep-09 22:57
S.Aijaz16-Sep-09 22:57 
AnswerRe: can ajax run if javascript is disabled on client browser Pin
Manas Bhardwaj16-Sep-09 23:16
professionalManas Bhardwaj16-Sep-09 23:16 
GeneralRe: can ajax run if javascript is disabled on client browser Pin
Rajeshwar Code- Developer16-Sep-09 23:32
Rajeshwar Code- Developer16-Sep-09 23:32 
GeneralRe: can ajax run if javascript is disabled on client browser Pin
Manas Bhardwaj16-Sep-09 23:56
professionalManas Bhardwaj16-Sep-09 23:56 
AnswerRe: can ajax run if javascript is disabled on client browser Pin
Muhammad Mazhar17-Sep-09 9:11
Muhammad Mazhar17-Sep-09 9:11 
QuestionPrint problem Pin
SUDHAKAR PALLAM16-Sep-09 22:03
SUDHAKAR PALLAM16-Sep-09 22:03 
AnswerRe: Print problem Pin
sashidhar16-Sep-09 22:52
sashidhar16-Sep-09 22:52 
GeneralRe: Print problem Pin
SUDHAKAR PALLAM16-Sep-09 23:09
SUDHAKAR PALLAM16-Sep-09 23:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.