|
Hello,
I need to form string point_number + point_name and display it in my DropDownList as text.
I have a string of blanks form rezul string like this:
rez = point_number + blanks.substring(0,length(blanks) - length(point_number)) + point_name
Unfortunatly I saw that in DropDownList the string is displayed with only 1 blank between number and name : ((
Then I replace blanks to _ and everything was allright.
What I need to change in DropDownList to force it display blanks?
Thank you
|
|
|
|
|
If I am not mistaken this is because HTML removes any duplicate spaces. Try replacing spaces with & nbsp; to force them in there.
-- modified at 17:05 Thursday 12th July, 2007
Darroll
|
|
|
|
|
Ok - I'll edit it for you. He needs to put in.
|
|
|
|
|
Hello,
Thank you for answers but I tryied to replace blanks with but it displayed like this
123 Name
: ((
Here is my code:
On DropDownListDataBound
for (int i = 0; i < DDListPoint.Items.Count; i++)
{
DDListPoint.Items[i].Text = DDListPoint.Items[i].Text.Replace(" ", " ");
}
When I should replace blanks? on the client side in Javascript?
Thank you : )
|
|
|
|
|
Oops : )
second string in Replace is
|
|
|
|
|
Hello,
May be somebody knows another way to solve the problem, is there columns in DropDownList or anything else to apart data?
|
|
|
|
|
Hello,
I find solution to my problem : )
string blanks = HttpUtility.HtmlDecode("   ");
rez = point_number + blanks.substring(0,length(blanks) - length(point_number)) + point_name
|
|
|
|
|
I have a cold fusion application running on Java VM and have intentions of moving to an ASP.Net code base running on a .NET framework. The following are my reasons for making this move:
1. Less expensive server maintainace license fees
2. More support for problem resolution
3. More accessible developers as there are way more .NET developers than cold fusion.
Are these valid reasons?
Are there any more technical or otherwise reasons that i may be missing?
|
|
|
|
|
I think #1 is enough, but the decision is ultimately yours.
only two letters away from being an asset
|
|
|
|
|
I would have to say reasons #1 and #3 are the most valid ones. About 7 years ago a place I used to work for wanted to do Cold Fusion, but nothing ever really materialized with them.
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
|
|
|
|
|
Hello all
I am new in asp . I have write a pagging code in it connected with sql server database . But problem is that it show the record at multiple pages. suppose name of user one is show at page one , Its again show in page two and some of record of page three also . I can not identified its reason. My code is below.
<%
Option Explicit
Dim conn,rst,sql,Rs,uname,passwd
Dim intTotalpages,intCurrentpage,intI,strQ,j, varSearch,objConec
Const intPagesize=10
intI=1
If Request("currentPage")="" Then intCurrentpage=1 Else intCurrentpage=Request("currentPage")
if request("currentPage")="0" Then intCurrentpage=1
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "PROVIDER=MSDASQL;" & _
"DSN=subscribedsn;DATABASE=subscribe;UID=xyz;PWD=xyz;"
Set conn = Server.CreateObject("ADODB.Connection")
With conn
' Set .ActiveConnection=objConec
.cursorLocation=3
' .cachesize=intPagesize
' Set conn =objConec.Execute (StrQ)
End With
conn.open "PROVIDER=MSDASQL;" & _
"DSN=subscribedsn;DATABASE=subscribe;UID=xyz;PWD=xyz;"
sql = "select * from table "
'response.Write(sql)
'response.End()
Set rst = Server.CreateObject("Adodb.Recordset")
rst.Open sql, conn, 3, 3
If Not rst.Eof Then
rst.pageSize=intPageSize
If Not isNumeric(intCurrentpage) Then intCurrentpage=1
If (CInt(intCurrentpage) > rst.PageCount) Then intCurrentpage=1
rst.absolutePage=intCurrentpage
intTotalpages=rst.pageCount
End If
%>
<title>XYZ
| | | |
| |
<% If rst.EOF or rst.BOF then %>
<%
Else
do while not rst.EOF %>
<% rst.movenext
loop
rst.movefirst
End If
%>
List Of Subscribe Members | User Name | E Mail | Project | Country | Dated | Status | Delete | No Registration posted !( Database Empty ) | <%=rst("nam")%> | <%=rst("email")%> | <%=rst("prj_type")%> | <%=rst("country")%> | <%=rst("date_field")%> | <%=rst("status")%> | "> |
| <%if not rst.BOF or not rst.EOF then%>
Page -»
<%
for j=1 to intTotalpages
if j=int(intCurrentPage) then
%>
?currentPage=<%=j%>"><%=j%>
<%else%>
?currentPage=<%=j%>"><%=j%>
<%
end if
next
end if
rst.close : conn.close
set rst=nothing : set objConec=nothing
%> | | |
Regard's
Kaushik
|
|
|
|
|
Y_Kaushik wrote: sql = "select * from table "
Try with ORDER BY clause. You can use TOP expression too.
SELECT * FROM table ORDER BY <field1>
SELECT TOP 5 * FROM table ORDER BY <field1>
SELECT TOP 5 PERCENT * FROM table
SELECT TOP 5 PERCENT WITH TIES * FROM table ORDER BY <field1>
PERCENT
Indicates that the query returns only the first expression percent of rows from the result set.
WITH TIES
Specifies that additional rows be returned from the base result set with the same value in the ORDER BY columns appearing as the last of the TOP n (PERCENT) rows. TOP ...WITH TIES can be specified only in SELECT statements, and only if an ORDER BY clause is specified.
All the above are different way of getting the data in an ordered manner.
|
|
|
|
|
Sir
In this case my table contain only 41 record it show 41 record on page 1 and show total page 5 on page 2,3 and 4,5 its show the repetation of records.
My problem is that how set the limit of record on page show that page can not be displayed on page 2 and so on
Regard's
Kaushik
|
|
|
|
|
hi when i allow sorting on gridview i recieve this error message
The GridView 'GridView1' fired event Sorting which wasn't handled.
i also add this event in gridview and add this code
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
GridView1.Sort(e.SortExpression, e.SortDirection);
}but infinite loop occurs and page give error
Please tell me solution of this problem
Thanx 
|
|
|
|
|
you have to AllowSorting="true" set for the GridView and therefore you need to have event handler for its Sorting event
Hope this may be your problem.
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
hi
i set AllowSorting="true"
but what code i write in this event
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
GridView1.Sort(e.SortExpression, e.SortDirection);
}
i need sorting on colomn heading
Please tell me right solution
Thanx
|
|
|
|
|
You only need to handle the sorting event if there is some special case for sorting. The default mechanism should be sufficient for sorting on the column header.
only two letters away from being an asset
|
|
|
|
|
try with this code:
protected override void OnSorting(GridViewSortEventArgs e)
{
if (AllowMultiColumnSorting)
e.SortExpression = GetSortExpression(e);
base.OnSorting(e);
}
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
You need to refresh the data source so that it's sorted accordingly.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Where is GetSortExpression(e); How is this helpful?
only two letters away from being an asset
|
|
|
|
|
You're getting an infinite loop because calling GridView1.Sort will fire the GridView1_Sorting event (I'm sure you figured that out aleady)
I think GridView will only sort automatically if you're using one of the new DataSource providers, like SqlDataSource, XmlDataSource, ObjectDataSource, etc. (I could be wrong about that, but so far that's been my experience).
You could try something like:
private void FillGrid( string sortExpression, SortDirection sortDir )
{
string sort = sortExpression + " " + (sortDir == SortDirection.Descending ? "desc" : "" );
DataTable dt = GetDataTableFromSomewhere();
DataView dv = new DataView(dt, "", sort, DataViewRowState.CurrentRows );
GridView1.DataSource = dv;
GridView1.DataBind();
}
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
FillGrid(e.SortExpression, e.SortDirection);
}
Viewstate could become an issue doing it this way. I typically disable view state on grids though, but then you have to work around a bunch of other issues.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I add a asp Checkbox in the Datagrid ItemTemplate and HTML checkbox in Header Template.In the datagrid am loading the images and the path from the server folder.am loading all the images in the page load event.page load event as follows
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataSet ds = new DataSet();
DataTable dt = new DataTable("Photos");
dt.Columns.Add("Photos", Type.GetType("System.String"));
foreach (string Files in Directory.GetFiles(System.Web.HttpContext.Current.Server.MapPath("Photos"), "*.jpg"))
{
dt.Rows.Add(Files);
}
ds.Tables.Add(dt);
this.dgPhotos.DataSource = ds;
this.dgPhotos.DataBind();
}
}
All the images am getting in the Datagrid.but my problem is,i want to delete the checked images.the delete code as follows
foreach (DataGridItem item in dgPhotos.Items)
{
CheckBox chkBox = (CheckBox)item.FindControl("chkItem");
if (chkBox.Checked)
{
File.Delete(item.Cells[2].Text);
}
}
while clicking the Header template checkbox it will select all the Item template checkbox[Javascript function],all the sub checkbox are checking fine.but the problem is i will not get the checked state in the delete event,getting checkbox.checked=false.so i cannot delete the images.in the page load event if am not using !Postback and if i select one by one in the Itemtemplate checkbox i could delete,i will get checked=true but if select header check will not get.what is the problem.Is there any solution for this.
|
|
|
|
|
Have you solved this problem?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Hi All
I have a gridview with 2 bound columns and 3 TemplateField columns containing 3 checkboxes. Iam not being able to display the check boxes correctly although thrie values are correct in the database.
Any Ideas?
|
|
|
|
|
I recommend fixing your code so it works.
For a more detailed answer, try posting some code, and explaining what you mean by 'unable to display correctly'
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|