Split character in word [closed] - asp.net

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am trying to separate this word, as an example the String is ASP_01, so I want to separate it into two like store ASP in one variable and the 01 in another variable, is it possible for me to do this in asp.net visual basic,
I am newbie in this,
Thanks for helping me.

You need to use the Split Function. Link
dim str As String = 'ASP_01'
dim newWord As String = str.Split(new Char {"_"c})
dim 1stWord As String = newWord[0] //result is "ASP"
dim 2ndWord as String = newWord[1] //result is "01"

Related

Why is there a conversion issue when updating/inserting into a Sql table [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Error:
Conversion from string "INSERT INTO [myDB].[dbo" to type 'Double' is not valid.
I am trying to add the dropdownlist index, the dropdownlist selected item's value, the dropdownlist selected item's text and the text from a textbox.
How can I resolve the issue.
ddlInsurancePlans.SelectedIndex is a number, you're using the addition operator, therefore you're implicitly trying to convert the left (string) into a format compatible with the right (double).
Use .ToString to explicitly cast SelectedIndex as a string.

How to transfer two datatable into gridview? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
i want transfer 2 datatable to a gridview.
for example i have datatable1 and datatable2 and fill two datatable Now both of them fill in gridview.
please help me thanks.
for example
datatable dt1=new datatable();
datatable dt2=new datatable();
for(i=0;i<=8000;i++){
dt1.rows.add();
dt2.rows.add();
///fill both of them
}
gridview.datasource(dt1+dt2)//how can fill both of them
The DataTable class has a Merge method, which returns a new DataTable that you can use as your datasource:
http://msdn.microsoft.com/en-us/library/fk68ew7b.aspx
U can show it by using SoredProcedure in DB...
or
see the following link
http://www.aspnettutorials.com/tutorials/database/add-data-to-gridview-from-multiple-tables-in-asp-net-4-0-and-c/

How can I grab just the first letters of a string? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am passing a username in a session like below and would like to get the first letter of the first name and last name. So for example Doe, John I would like to get "JD" etc. Any idea how I would do this? Thank you
Session("Username")
As an example following your requirements. Lastname stored in first position and firstname stored in last position, but the order of the returned string is First/Last
string username = "Doe, John";
string[] parts = username.Split(' ');
string result = parts[1].Substring(0,1) + parts[0].Substring(0,1);
Console.WriteLine(result);
No error checking is present for clarity, but if you want this for a real work some checks on length of parts is mandatory
If you have only spaces between the parts of the username, try with this RegEx :
initials = Regex.Replace(Session("Username")," *([^ ])[^ ]*","$1")
--> the string "[^ ]" gets every character which is not a space (you can add the char '-' if you want)
By this way, you get a solution which works with people called "John Joe Jibbs" ^^
This is just a proof of concept.

How to change Wordpress Post Query variable in URL ("p") [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Wordpress have "p" variable in query string for showing post where id of post = p variable. Is there any way to change this var name? Or to add variable that will be doing the same thing? Im looking for a way to make wordpress recognize query like this:
wordpresssite.com/?id=123
Those are just query vars , and P?simply means post .
To change it you can create a custom post type (CODEX).
Then, for example, if your custom post type name is : "bulding" , it will show as
?bulding=xx
Just as page shows as page_id= and attachment shows as attachment= ( both are post types , but reserved and implemented as default )
That being said, I do not really understand why one would like to change it , and why is that disturbs , but I would sure like to hear that ..

how to set the row number of row for checkboxlist in asp.net? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have one checkboxlist with repeat columns=3. If the item count for the datasource of it is less than 20,i need to generate 20 rows with single column.If it is between 21 and 40 then 20 rows and two columns.if it is between 41 to 60 then 20 rows and 3 columns and for more than 60 records then as normal that checkboxlist behave.
Any suggestion is appreciated.
Thanks
Mohak
Try this:
int itemCount = <YOUR_DATASOURCE_ITEMS>.Count;
int columnCount = Math.Ceiling(itemCount/20.0)
<YOUR_CHECKBOX_LIST>.RepeatColumns = columnCount;

Resources