开发者

Custom phone numbers control

I have a database that stores an arbitrary number of phone numbers. There are a few pages that (should) allow admins to change these numbers and add them.

I plan to create a custom control that will:

  • Show al开发者_Go百科l existing numbers
  • Provide an edit button
  • In Edit mode, will show an add button
  • Have an add button that adds the requisite fields in a way that does not cause a postback.
  • Provide a save button (of course)

These seems like a complicated task. I've done a bit of research, but haven't found any ready-made solutions. Is there anything I should have spotted or should know before I go about writing this from scratch?


I've built something like this using jQuery. Use a table to display the phone numbers. Then, jQuery excels at being able to hook into button presses and manipulate elements on the page (wrap a table cell's contents with an input box, or add add a table row) without causing a postback, completely aside from any server-side ASP.NET controls. Then, on Save you can stuff the phone numbers into an <input type="hidden runat="server"> in a delimited format (e.g., "212-555-1212|617-555-1212") and let the Save button do a regular postback.

You could probably find a commercial datagrid control with Ajax features to enable editing and add rows but you'd probably spend as much time customizing it as you would writing it from scratch with jQuery. It's the sort of thing you've seen dozens of places but everyone does it a little different.


I've never seen a custom control that worked specifically like that. I'd search on CodeProject to see if a custom control exists before writing one.


Are the existing numbers in a variety of formats? For example: 123-456-7890 and (123) 456 7890? If so, you may have to decide in advance on the format you are going to use and then run a script to clean up the existing records. I would use JQuery as suggested by Marc to enhance the editing experience. Validation will have to be precise.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜