|
Hi,
I get a string say "07915 25D3". The problem is, the value before the space can be anything from 1 - 12 in length, and the value after the space anything from 2 - 12 characters.
I just need to get the value after the space, "25D3", in the string. I am not sure how to do this.
|
|
|
|
|
Hi
assuming the character is always a space you could use the split() function:
----------------------------------------------------------
Dim _str As String = "07915 25D3"<br />
dim _s as string = str.Split(" ")(1).ToString
----------------------------------------------------------
In this instance _s will give you the value 25D3.
The argument passed into the split function is a character or number of characters are used to break down the string into an array.
The value of _s is evaluated to the 2nd element of the array (25D3)
Hope this helps
MJ
|
|
|
|
|
Thanks MJ,
It worked perfectly!! Just what I wanted.
|
|
|
|
|
There is one another way to do it.
suppose your string is stored in variable 'strCustId'.
String strRightText = strCustID.Substring(strCustID.IndexOf(" "));
|
|
|
|
|
Hi,
I tried to change datagrid selecteditem background color,if i do this when i mouseover on the datagrid the selectedItem Background color changed but i want mouseover event don`t fired on specific datagridselectedItem.How can i do this?
I have written my mouseover event in datagrid ItemDataBound.
Plz help me anyone,
|
|
|
|
|
give me an example for how to write a user defined functin in asp.net page.in a different class or in the same webform,if in different class we use how to wirite the code and inherit that function in main webform page
kissy
|
|
|
|
|
What's a user defined function?
What you are looking for may be something like this:
public class A
{
public void DoSomething();
}
And then on the web page:
A anInstanceOfA = new A();
anInstanteOfA.DoSomething();
-- modified at 4:48 Thursday 24th August, 2006
|
|
|
|
|
Yes above example is fine if you are using class then put that class in folder app_code
and if you will use
public static void abc()
{
code goes here........
}
in class xyz
then you can access method just by typing xyz.abc();
also you can define your functions in the web page
either using private or protected key wordd
private or protected void abc()
{
code goes here......
}
if you need further assistance dont hesitate to ask.
Naveed Kamboh
|
|
|
|
|
What exactly you want to do buddy... If you want to use nodes as links then use sitmap as the datasource.
|
|
|
|
|
hi. i want the user to select one of the nodes then after filling another fields he click the submit button so i can insert the value of these fields and the selected node value in the table i don't wnat the page to post back when the user select the node.
|
|
|
|
|
Hi,
We have 3 servers, under each servers certain applications(20 applications) are launched. For all these applications the authentication is to be done once(Single-Sign on). But, in case if users session is timeout in one application on one server, how the other applications in other servers can sense the same.
Give some soution for this.
P. Mohan
|
|
|
|
|
I have the solution if two buttons are there differently,but is it possible in a same button.if i click add then save,if i click update then save.add and update code can we write in the same button,if how
kissy
kissy
|
|
|
|
|
I am not able to understand from your message what you are trying to do. I understand that you have two buttons, but I don't understand how you want to change that.
Do you want two buttons that use the same code, or one button that does different things, or one button that does two things?
---
b { font-weight: normal; }
|
|
|
|
|
i want same two has to do different things.please
kissy
|
|
|
|
|
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
|
|
|
|