|
The only problem that I need to overcome is that whilst my div tag shows 5 list items, what I need to achieve is to expand the div tag just enough to show the other list items. For instance if I need to show 7 list items, I need to expand the div tag height just to show 7 items, and equally to expand the height if there are 12 items.
Therefore, how I can I dynamically increase the height to fit the number of items I want to show without showing too little or too height?
|
|
|
|
|
I see what you're saying. My method would just resize your div box to z set size no matter how many items need to be listed.
I think you need to count the number of items there are in the list when the page loads.
This is something probably best doing server side in whatever language you're using. Then pass the number to client side in a hidden field.
eg <asp:Label runat="server" id="myhiddennumber" visible="false"/>
Use this number to set the height of the div box in javascript.
This function needs to execute after the hidden field has been populated.
eg
function mylistboxsize(){
var getthelist = document.getElementById("myhiddennumber");
// multiply the number in the hidden field to get a height value for the div box. Here we're saying each item is worth 10px
var heightfordiv = getthelist.innerText * 10;
// set the height
document.getElementById('divboxid').style.height = heightfordiv + 'px';
}
The above javascript may need a bit of syntax correction however I think the 'method idea' would work.
|
|
|
|
|
Hi, you can put the items in another div(for example: id="divMoreItems") which is hidden first and which follows the first five items and is contained in your div. When you click the linkbutton, you can set divMoreItems's display="block" or "". When you click the linkbutton again, set divMoreItems's display="none".
modified 27-May-14 4:51am.
|
|
|
|
|
i found this code to upload a file into a sql database using the asp.net fileupload object (or vb)
i found it here
http://forums.asp.net/p/1480079/3451771.aspx
i think it works, but i am a learning noob and have a question...where does my dbase info go in the code?
1. If FleUpload.HasFile Then
2. Dim fileName As String = Server.HtmlEncode(FleUpload.FileName)
3. Dim extension As String = System.IO.Path.GetExtension(fileName)
4. If (extension.ToUpper = ".JPG") Or (extension.ToUpper = ".GIF") Then
5.
6. '**** Resize image section ****
7. Dim image_file As System.Drawing.Image = System.Drawing.Image.FromStream(FleUpload.PostedFile.InputStream)
8. Dim image_height As Integer = image_file.Height
9. Dim image_width As Integer = image_file.Width
10. Dim max_height As Integer = 120
11. Dim max_width As Integer = 160
12.
13.
14. image_height = (image_height * max_width) / image_width
15. image_width = max_width
16.
17. If image_height > max_height Then
18. image_width = (image_width * max_height) / image_height
19. image_height = max_height
20. Else
21. End If
22.
23.
24. Dim bitmap_file As New Bitmap(image_file, image_width, image_height)
25. Dim stream As New System.IO.MemoryStream
26.
27. bitmap_file.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg)
28. stream.Position = 0
29.
30. Dim data(stream.Length) As Byte
31. stream.Read(data, 0, stream.Length)
32. '**** End resize image section ****
33.
34.
35. Dim myConn As New SqlConnection(ConfigurationManager.ConnectionStrings("cs").ConnectionString)
36. Dim mycmd As New SqlCommand("se_equipmentimages_insert", myConn)
37. mycmd.CommandType = CommandType.StoredProcedure
38.
39. mycmd.Parameters.AddWithValue("@equipment_id", id)
40. mycmd.Parameters.AddWithValue("@image_file", data)
41.
42. Try
43. myConn.Open()
44. mycmd.ExecuteNonQuery()
45. Catch ex As Exception
46. Finally
47. myConn.Close()
48. End Try
49.
50. Else
51. lblError.Text = "Please only upload .jpg or .gif files"
52. lblError.Visible = True
53. End If
54. Else
55. lblError.Text = "No file selected"
56. lblError.Visible = True
57. End If
to wit...
dbase name: mydBase
table name: dBaseTable
column names :fileOne, fileTwo, fileThree
where in the code above does this go?
also, how does this code work for multiple fileuploads at once?
thanks
james
|
|
|
|
|
What do you mean by dbase info ?
If you mean connection string, it is here.
oedipusrex wrote: Dim myConn As New SqlConnection(ConfigurationManager.ConnectionStrings("cs").ConnectionString)
He added a connectionString section in the web.config with the name "cs"foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Your database information is probably in the web.config file.Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
I used ASP.net with C#, I face always this problem when I redirect my aspx page with some ajax controls. It took too much time. If you have any solution about this so please Help!!!! Me....
Example:
Response.Redirect("~/MemberInfo/UserFrontPage.aspx");
|
|
|
|
|
Is this problem with all page redirection or some specific page ?
|
|
|
|
|
same problem with all pages, even I used simple page with some text, redirects some time slower.
|
|
|
|
|
Hi, you can try server.transfer, it only has one postback, but Response.Redirect has two.
modified 27-May-14 4:51am.
|
|
|
|
|
I think you can redirect page in client browser using js code.
modified 27-May-14 4:50am.
|
|
|
|
|
Can you explaim me how to redirect page using JS but, Page must open in same explorer not in another Popup window.
|
|
|
|
|
since you are using C#, this is how it will work
Response.Redirect(@"~/MemberInfo/UserFrontPage.aspx");
or
Response.Redirect("~//MemberInfo//UserFrontPage.aspx");
and not
Response.Redirect("~/MemberInfo/UserFrontPage.aspx");
Hope it's helpful?Tunsten
|
|
|
|
|
Hi,
I am using a multiview in one of my webpage but when I am switching from one view to another in multiview I can't access any control value of previous view to current view. Why am I geeting this problem?
Thanks & Regards
Rock Star
|
|
|
|
|
At a time only one view gets rendered on page.So you cannot access the controls of one view from another.If you have to access some value from another view ,you can put it in viewstate etc. Cheers!!
Brij
|
|
|
|
|
How can we do paging and sorting in a single gridview?
Known is a drop, unknown is an ocean
|
|
|
|
|
|
Go through the following link
Click hereCheers!!
Brij
|
|
|
|
|
|
You can set "AllowPaging=True" and "AllowSorting=True".
modified 27-May-14 4:50am.
|
|
|
|
|
iam using visual studio 2005 with ajax controltoolkit library but after design the form during runtime form is displaying blank page , that no controls are displayed.
|
|
|
|
|
there may be issue of the iis so check that one
if not than send you aspx page
|
|
|
|
|
r u using a formview or gridview.. if so then the controls will display only if there is data..unless u specify the emptydatatext..
|
|
|
|
|
Hello
I have one problem.I put one textboxe on my form for searching.I have added one image in left side of textbox using css class.
My problem is:I want to add second image near to first image and when i click on that image,one popup will be displayed which contains all data from database.
i want to do all this procedure in one textbox.
If u have any idea,pls suggest me.
Thanks
|
|
|
|
|
You cannot do it directly.
Use any trick.
Like use div tags (runat=server) containg images and place it on the textbox by setting its position:absolute.
and on the click on div tag write the server side code.
The miracle is this--the more we share, the more we have.
|
|
|
|