Thanks to S. Justin Gengo, MCP, I think I have a viable editing senario that
would enable searching etc. The general flow goes like this:
Start on a search screen. Select a record. Edit page is displayed. On
save or cancel the user is returned to the search screen. I'm doing this by
creating two user controls (Search and Edit) and placing them in a multiview
with two views. I've got it working but there's a few things that don't seem
very clean to me and was wondering if there's a better .net ish way to do
this.
The page that holds the views:
Partial Class _Default
Inherits System.Web.UI.P age
Protected Sub Search1_Selecte d(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Search1.Selecte d
Edit2.RecordId = Search1.RecordI d
Edit2.Edit()
MultiView1.Acti veViewIndex = 1
End Sub
Protected Sub Edit2_Finished( ByVal sender As Object, ByVal e As
System.EventArg s) Handles Edit2.Finished
Search1.Refresh ()
MultiView1.Acti veViewIndex = 0
End Sub
End Class
The page that searches:
Partial Class Search
Inherits System.Web.UI.U serControl
Dim _recordId As Integer
Public ReadOnly Property RecordId() As Integer
Get
Return _recordId
End Get
End Property
Protected Sub GridView1_Selec tedIndexChanged (ByVal sender As Object, ByVal
e As System.EventArg s) Handles GridView1.Selec tedIndexChanged
Dim row As GridViewRow = GridView1.Selec tedRow
_recordId = CInt(row.Cells( 1).Text)
RaiseEvent Selected(Me, New EventArgs)
End Sub
Public Event Selected As EventHandler
Public Sub Refresh()
GridView1.DataB ind()
End Sub
End Class
The page that edits
Partial Class Edit
Inherits System.Web.UI.U serControl
Public Property RecordId() As Integer
'How do I not use an extra textbox that's hidden?
Get
If IsNumeric(TextB ox6.Text) Then
Return CInt(TextBox6.T ext)
Else
Return 0
End If
End Get
Set(ByVal value As Integer)
' Special textbox just for the primary key
TextBox6.Text = CStr(value)
SqlDataSource1. DataBind()
End Set
End Property
Public Sub Edit()
Me.DetailsView1 .ChangeMode(Det ailsViewMode.Ed it)
End Sub
Protected Sub Button1_Click(B yVal sender As Object, ByVal e As
System.EventArg s)
'Update, how do I know if there was an error and not raise the event?
DetailsView1.Up dateItem(True)
RaiseEvent Finished(Me, New EventArgs)
End Sub
Public Event Finished As EventHandler
Protected Sub Button2_Click(B yVal sender As Object, ByVal e As
System.EventArg s)
DetailsView1.Ch angeMode(Detail sViewMode.ReadO nly)
RaiseEvent Finished(Me, New EventArgs)
End Sub
End Class
Any thoughts on cleaning this up a bit and making the search screen control
drive the edit control better are appreciated. 0 974 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Craig Thomson |
last post by:
I was wondering what people do with text provided by the user in a
form. Some cleaning needs to be done at some stage if you are going to
be putting it in a database or displaying it etc. But when is the time
to do that?
Do you clean it as soon as you get it?
Do you pass around the original text and clean it when you use it?
What about magic slashes? You need to addslashes before using in a db
statement, but you need to strip them...
|
by: Christopher Benson-Manica |
last post by:
Yesterday I changed some code to use std::vectors and std::strings
instead of character arrays. My boss asked me today why I did it, and
I said that the code looks cleaner this way. He countered by saying
that he was regarded the dyanamic allocation that C++ STL classes
perform as being very inefficient. He also said that he wasn't
particularly interested in clean code (!). My question to the group:
In what situations, if any, would...
|
by: lallous |
last post by:
Hello,
This question was asked in comp.lang.c++ and the answers involved the use of
objects whose destructors are automatically called when getting out of
scope, however I was expecting suggestions that doesn't involve the use of
objects. So here is the question again.
I have a function like:
void fnc() {
|
by: Rob R. Ainscough |
last post by:
I have a moderately sized web application (30 pages, and 20 DLLs) that takes
10-20 minutes to "Build Solution" after I do a "Clean Solution" -- this is
ONLY apparent after a "Clean Solution"
I have a reasonably power workstation (3.06Ghz dual Zeon with 4GB RAM and
10K RPM hard drives) -- this problem ONLY occurs immediately after I do a
Clean Solution and then "Build Solution" -- if I just run Build Solutions
(one after another) it only...
|
by: Nick Gilbert |
last post by:
Hi,
In my VS.NET 2005, if I choose Build Clean Solution, the BIN folder is
not touched. Shouldn't it delete all the dll and pdb files in that
folder first? Instead, I'm finding I have to do it manually.
Also, when I change from Debug to Release, all the pdb files remain in
the bin folder. Shouldn't these be deleted automatically?
Please let me know what the "Clean Solution" is supposed to do (if it's
| |
by: Koliber (js) |
last post by:
sorry for my not perfect english
i am really f&*ckin angry
in this common pattern about dispose:
//////////////////////////////////////////////////////////
Public class MyClass:IDisposable
|
by: Christopher |
last post by:
How can I make a vc++ project erase its $(OutDir) upon using the clean
command?
I tryed Properties->Configuration Properties->General->Extensions to
Delete
on Clean
Add $(ObjDir)
And it didn't work. Of course I know it is asking for extentions and
not a
|
by: service0031 |
last post by:
Housekeeping is an interesting job or career where things are always
changing, and even though you may work in a less than clean
environment, you are required to always look clean and professional.
Having appropriate housekeeping uniforms, dresses, or skirts for your
cleaning tasks is a necessity that simply cannot be ignored. You are
expected to look your best under less than ideal circumstances, and
this mean having the highest quality...
|
by: plenty900 |
last post by:
Hello,
I'm trying to build a large project, and I've found that
when something doesn't compile properly, and I attempt
to re-build it, Visual C++ Express doesn't make a new
attempt. So then I try to clean the solution, but
this has literally no effect because when I try to
build after that, again no attempt to made to build.
Can someone tell me to really to clean the solution,
|
by: Simon |
last post by:
As title. How to clean out VSWebCache? Any good way to do that?
Thanks.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |