C# - Remove A Defined Part Of A String?
Mar 15, 2011I have this string: "NT-DOM-NVMTA" How can I delete the first part: "NT-DOM-NV" To have this as result: "MTA"
View 6 RepliesI have this string: "NT-DOM-NVMTA" How can I delete the first part: "NT-DOM-NV" To have this as result: "MTA"
View 6 RepliesI'm getting the following error, ever since I moved my DataTable to a different function. Both DataSource and DataSourceID are defined on 'TestView'. Remove one definition.By all means if you have tips on style / standards, I welcome that as well, I am very new to aspx coding. Any idea what could be causing this? It wasn't happening before when it wasn't its own function. Is it a local variable problem?
Here's the code for the code that binds and is highlighted in the error:
testDAO tda = new testDAO();
DataTable testTable = new DataTable("TestView");
testTable = tda.GetTestTable();
TestView.DataSource = testTable;
TestView.DataBind();
Here's the code for the GetTestTable():
public DataTable GetTestTable()
{
DataTable testTable = new DataTable("TestView");[code]....
List view in aspx file:
<asp:ListView ID="TestView" runat="server">
<ItemTemplate>
<tr id="row" runat="server" class='<%# Container.DataItemIndex % 2 == 0 ? "row" : "altrow" %>'> [code]....
Is it posible to remove some part of the html in the viewsource?
Quote:
[Code]...
look at the html viewsource below, I want to remove all lines after test word.
HTML Code:
[Code]...
specify method to remove web Part Zone names.
View 3 RepliesWhen i click for bug an aplication.
it's always show this a notification
{"Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition."}
view on browser application
Line 33: Line 34: GridView1.DataSource = dtLine 35: GridView1.DataBind()Line 36: End SubLine 37:
This is an my vb code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Me.BindGrid()
End If
End Sub
Private Sub BindGrid()
[Code] .....
I'm working on two gridviews , each one binded to an sqldatasource object,when I want to modify the 2nd gridview (DataSource=DataTable) an error fired !Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.
View 4 RepliesI have a db connection string 'ApplicationServices' defined in the connectionString section of web.config and 3 Entity Framework connection strings which have the provider connection string attribute with the same connection string as the one in 'ApplicationServices'. Is there a way to reference connectionString in 'ApplicationServices' for the provider connection string attribute of the EF connection string in the web.config, rather than providing the connection string all over again?
View 1 Repliesi have date column in my database that is that save date and time toghether i need saving date and time in my database .
now i want show date column in my gridview but i dont want it show the time i want it show just date how i can do it?
i have a website that use globalization to several languages (VB Framework 4.0)
i need to get all languages exist in App_GlobalResourses directory because i don't know in future the website owner will add or remove some languages
for that i try to access in App_GlobalResources folder and i list the existing files in there now i have an array of fileInfo but i don't know how can i get some part of the file name
it return "General.resx", "General.en-US.resx", "General.fa.resx" and so one...
in my database table there are 200 records.in description column record value is like .....
sometextLASER
sometext1LASER
sometext2LASER
i want to delete LASER from every record using sql.can enyone tell me how to do it.
I am trying to insert data from a booking reservation into my database.
MySQL = "Insert into [RestaurantSteakHouse].[dbo].[reservation]([customerid],[reservationdate],[noofguests],[notes],[tableid]) values (" & id & ",'" + Session("ReservationDate") + "'," & Session("Noofguests") & ",'" + Session("Notes") + "','" + Session("TableId")
+ "');select @@identity"
Operator '&' is not defined for string "Insert into [RestaurantSteakHous" and type 'ListItem'.
Let's take this string has an example:
D:/firstdir/Another One/and 2/bla bla bla/media/reports/Darth_Vader_Report.pdf
I want to cut the first part of the path:
D:/firstdir/Another One/and 2/bla bla bla
And replace it with **../**, and keep the second part of the path (media/reports/Darth_Vader_Report.pdf)
If I knew the length or size of it, I could use the Replace or Substring. But since the first part of the string is dynamic, how can I do this?
Update
After StriplingWarrior question, I realized that I could have explained better.
The objective is to replace everything behind /media. The "media" directory is static, and will always be the decisive part of the path.
I am trying to retrive the query string value and display it on the aspx page. The query string is passed from a gridview. Everything works fine except i noticed that when there is an '&' in the query string then the label on the page will display only uptil the '&' (i.e. excluding the '&'). Just so to let you know. I retrive the value of the querystring into a string variable and then assign it to the variable. I have noticed this only for '&' character but maybe there are more characters with sinmilar bahaviour that I am not aware of.if anyone has a workaround on displaying all the content from the querystring then do share.
View 4 RepliesWhy is it that a simple string inside a webpart not showing when the application is run ? Actually my requirement is to use a fusion (usually called as a function) and Visifire chart (usually called as a function from javascript) in web part which i'm not able to consume at all.
View 5 RepliesI'd like to change my routes so that instead of having:
/Users/Edit?UserID=1
I can do
/Users/Edit/1
How can I create a custom route to do that?
Also, can someone direct me to a good tutorial on routes? I don't wanna create a post every time I have a simple problem with routes.
I know that the problem is my field having NULL values. However, I don't know how to have it process the code even if the field have nullshere's my code:
[Code]....
I have a table1 with first column having: usjim, uskim, uspeter, john ....
I need to insert this column into table2 excluding us if contains any ( extract substring basically)
I have tried doing this but doesn't work
[code]....
I have this string at the output :
Round Base<img src='./1_sm.jpg'>
72" Pole<img src='./pole72.jpg'>
AFC22<img src='./afc22.jpg'>
This are in array list
I want to remove string start from <img src=???>.
I want final output like this:
Round Base
72" Pole
AFC22
my insert query is generated in runtime here i want to remove last ',' character from that string query
my string is below
Insert Into Payroll_AllowanceSettings(EmpID,PFNO,CompanyID,Basic,DA,HRA,CONV,SAll,LeaveAll,OT,Bata,Others,)Values(EmpCS001,1234,1,1,2,3,4,5,6,7,8,9,)
here i want to remove last ', ' character both coloumn fields and value fields how can i remove the characters
i have string
Dim str As String = "C#app_wiod_200"
i want to remove characters from wiod in string which one is the best string function to do this.
how to remove string character in asp.net, im having a string variable string str = "1234, ". i want to remove the comma. its possible ?
View 4 RepliesI have users emails in my database and when i retrieve those usernames, i want to remove every charecter after the @ charecter in the email for example, i have myname@domain.com i want to cut that to myname.
View 3 Repliesi want to display values in dropdownlist using querystring[which is successfully happening] but the problem is when id passed in querystring is 7.17 then in dropdownlist it is displaying values as 7 . 1 7....but i want to display it as 7 and 17...
here is a part of the code
string imageid;
string logoid;
string id1;
string id2;
String Name;
protected void Page_Load(object sender, EventArgs e)...
string="/?UPID=1000001&One=1&Two=2"
UPID is always equal to 7 digits. I want to remove "UPID=(any 7 digits)".
I'd like the output to be:
string="/?One=1&Two=2"
Or if no query strings
string="/"
I would like to insert the following into a string
<p>some text here</p>
<p>some text here</p>
<p>some text here</p>
I want it to go into a string as follows
<p>some text here</p><p>some text here</p><p>some text here</p>
i.e. without the carriage returns.