|
Hi
If u want two different things to do at two different time, I can suggest a solution.
When a record is to be edited, change the text of the button as "Update", and in the same manner, when a new record is to be inserted ,Change the Text of the button as "Insert".
Then on the server side use the Text property of the button to determine what action needs to be taken.
Ex:
On Server Side:
In onButtonClick function you check
switch(button1.text )
{
case"Update":
// Update Block
break;
case"Insert":
//Insert Block
break;
}
I don't know exactly if it'll help you or not. But if you provide me some more information, then i can suggest you something good.
Irshad Ahmad
|
|
|
|
|
ya i had Add,update,save buttons.i have given code differently for both add and update,my problem is i have to call these two functions in save button.after adding a new record i give save,after update also i give save,
so my problem is i need to give code in save button as per the actions i am doing.please if understand give me reply,
thanks for ur answer
kissy
|
|
|
|
|
Probably the answer is same put the update functionality in a function and call that function when you are done with insert in the same button.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Ok...
Now I understand it. I would suggest you to take a static string say strSaveMode. Assign its value as "Add" on Add button click or if Update button is clicked then assign its value as "Update".
On clicking on Save button check the value of strSaveMode.If it is "Add" then call Add block of code. If it is Update then call Update block code.
Example:
Let cmdAdd,cmdUpdate and cmdSave are three buttons.
Declare a string at the class level like:
static string strSaveMode = "";
Now, In cmdAdd button click method:
-----
strSaveMode = "Add" ;
-----
-----
Similarly ,
write
In cmdUpdate button click method:
-----
strSaveMode = "Update" ;
-----
-----
Then in cmdSave button click :
-----
if(strSaveMode == "Add")
// Add Block
else if (strSaveMode == "Update")
//Update Block.
Hope it works.;)
Irshad Ahmad
|
|
|
|
|
ya but it is working only for some function ie add,both are not working,code is as you have given.help me out,wats the wrong with my code.
kissy
|
|
|
|
|
If possible,Please send me the code snippet u r using.....May be I can help you.
Irshad Ahmad
|
|
|
|
|
i have seperate code for both insert and update,i called as below.it only works for insert not for update.
try to understand and give me solution
Public Sub saveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
If savemode = "updte" Then
updat()
Else
insrt()
End If
End Sub
//same for the update button with modifications
Public Sub Add_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Add_Button.Click
Page.RegisterStartupScript("SetFocus", "document.getElementById('" & nameBox.ClientID & "').focus();")
updat_Button.Enabled = False
savemode = "Add"
End Sub
kissy
|
|
|
|
|
It looks fine.
I hope u'd written like this for update button
Public Sub Update_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Add_Button.Click
Page.RegisterStartupScript("SetFocus", "document.getElementById('" & nameBox.ClientID & "').focus();")
add_Button.Enabled = False
savemode = "updte"
End Sub
If after this also , it is not working, please check that save mode variable has been declared as 'static' (I guess in VB.net , it'll be 'shared').
Hope it works....
Irshad Ahmad
|
|
|
|
|
there is no static varible declaration in asp.net.i am using asp.net with vb.
how to do this ,plz help me out .how to declare
kissy
|
|
|
|
|
Private Shared strSave As String
Instead of static variable we have shared variable in VB.net.
I hope it will surely work.
Irshad Ahmad
|
|
|
|
|
Hi
In VB.net we have shared variable which does the same work as static in c#.net.
Please check it.If doesn't work ,I'll suggest another method which although works fine butu is an overhead performance wise.;)
Irshad Ahmad
|
|
|
|
|
Little pseudocode:
Sub Save_Click
DoSave()
End Sub
Sub Update_Click
DoSave()
DoUpdate()
End Sub
private Sub DoSave()
'Some code
end sub
private Sub DoUpdate()
'Some other code
end sub
|
|
|
|
|
Hi Friends,
I want to add controls dynamically to the form at any position as i wish.For that i want to identify the location on the form(page).How to do it in asp.net 2.0 . I know that so many talented people are here to help us.Please post a better solution for this as soon as possible.
Thankyou to one and all,
Regds,
Hari.
|
|
|
|
|
Hi Friends,
This is HariBabu, I want to drag items from one listbox and drop it in another listbox. I want code for this fuctionality in asp.net with c#. i know so many talented guys are here to help me.
Thankyou Guys(Also Ladies)
Regds,
Hari.
HariBabu Kuricheti
|
|
|
|
|
I am using a Javascript dropdown menu on my page. The drop down is dynamically added during page load an it works fine. The only issue is that, if there are any dropdownlist, listbox controls, the javascript menu is displayed behind the controls.
|
|
|
|
|
is it possible folder browsing using TreeView Control?
samir
|
|
|
|
|
Hi ,
I tried out the sample in
www.codeproject.com/useritems/neuralnetwork.asp[^]
I went through it and implemented.
I have doubts.When i executed the code,i loaded some of the bmp files for Pattern Detection and trained it for 1000 times.[say 8 images ,out of which 4 are same image only]
But it threw error while detection that
"Invalid input Image?Number of inputs doesnot match the number of neurons in the input layer".
Also there they have asked to give ascii value for the image.If i have selected the bmp file of a flower,what could be its ascii value?
How many input patterns i have to load?
please help me....
|
|
|
|
|
Hello:
I am now creating an excel file using xslt with the code below:
dim objFsXML as System.IO.StringReader
dim objXmlTxtWrt as System.Xml.XmlTextReader
dim objXPath as System.Xml.Xpath.XpathDocument
dim objXslTran as System.Xml.Xsl.XslTransform
'Create Output Stream to write the file to disk
objFsXML = New System.IO.FileStream(strExcelFile,System.IO.FileMode.Create)
objXmlTxtWrt = New XmlTextWriter(objFsXML,System.Text.Encoding.Unicode)
'Create Xpath Doc to be given as used while doing the XSL Trannsfor
objStrRdr = New StringReader(dsDataSet.GetXml)
objXmlTxtRdr = New XmlTextReader(objStrRdr)
objXPath = New XPath.XPathDocument(objXmlTxtRdr)
objXslTran = New Xsl.XslTransform
objXslTran.Load(strXSLTempFile)' here throws exception
However, when there is a blank or a special char in one of my headers, i've got an invalid xpath expression which throw an exception
what can i do ?
thx
|
|
|
|
|
I don't know to how to use Cookies in asp.net to remember my client login.
Please hlep me
Thanks
................
|
|
|
|
|
dim mycookie as new HttpCokokie("userinformationName")
mycookie.Value="userinformation"
Request.Cookies.Add(mycookie)
wish it could help u!
|
|
|
|
|
Thanks, but I don't understand yet what is proccess?
................
|
|
|
|
|
|
Hello All...
I am haveing one doubt on my project when i try
to run my project its shows some error
Error while try to run project:Unable to start project debugging
on the web server. The project is not configured to be debuged.
so kindly solve this problem and tell me solution.as early as possible
Many thanks Advance.
Dhulipudi
-- modified at 22:53 Wednesday 23rd August, 2006
hai all please clarify my doubt
|
|
|
|
|
use ctrl+F5 it will run the project
but not in debug mode
Navi
|
|
|
|
|
check this link:
http://support.microsoft.com/kb/306156/EN-US
Neeraj
|
|
|
|