I have one ASP.NET Page. It's for display customer information. Now I want this page to handle the f

B

Benny Ng

Dear All,
Now I met one problem in the development of my one application.

I have one ASP.NET page. It's for disply the information of customer.
But now I have one new requirement. It's to combine the "Edit" and "Display"
funtions into this page.
(It means if user want to edit the customer information, this page would
provided editing page to the user;
If the user want to display the customer information, this page would
providev the display function to the user.)

Actually in before I had 100% implemented these functions into one page.

My method is when the page is at "Display" status. Then first to hided
all editing elements of this page.(Set the property "Visible" to "false" for
each elements). And then shows all Labels controls with the corresponding
values. And vice versa.

But the disadvantages of this method is I Must to write many codes to
hide the editing fields and shows Label fields and vice versa.

Now I have one idea about that. It's to write a function to loop all
editing elements and let them invisible. After that shows the corresponding
values at the same space.

It means:
Status "Edit": <td><asp:textbox id=a1
text="testing"></asp:textbox></td>
Status "Display: <td>testing</td>

After that I needn't to write so much source codes to handle those
elements. One function enough for my purpose.

I used the following code to loop all elements of that page.But for the
next stage I still haven't no any ideas.

Any suggestion are appreciated for me. Thank you very much.

foreach (Control i in Page.FindControl("frmEdit").Controls)
{
//Response.Write(i.ID + "---" + i.GetType().FullName);

}

Best Regards,

Benny Ng
 
B

bruce barker

i'd write a new control that had a edit property. it would then render
an input or text depending on the edit setting.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top