|
Yes...
Another thing that I need to address, images are actually called as a new Request. So for every image request, IIS will spawn a new thread from its ThreadPool and create a Response.
If you can, you can just put the image data into the database or some storage and pass the id to the xml. Create one HttpHandler which will request the image with the id. Say your httphandler is ImageResource.axd .
you write using xslt as :
<img src="ImageResource.axd?id=59" /><br />
Now within the ProcessRequest , write the image data directly in the response stream.
This might be one useful way.
Also it is impossible to store image directly to client hard disk because of security issue in browser. What you can do, is place some Cache headers to the response, and the browser will automatically cache the image to its local storage and will not call the server again if the same resource is called for again.
Cheers.
|
|
|
|
|
Hi ,
On my ascx I have following
<asp:panel runat="server">
In this section...
<asp:label id="Label6" runat="server" text="Label">
<asp:label id="Label7" runat="server" text=" Label">
<asp:label id="Label8" runat="server" text=" Label">
.....
now if I try to access these label controls in my codebehind it says Label doesn't exist in the current context.
I checked the designer file and I even see it in designer file :-
protected global::System.Web.UI.WebControls.Label Label6;
|
|
|
|
|
Restart your visual studio!
Please don't forget to mark 'Good Answer', if you find it really a good one!
Kashif
|
|
|
|
|
Where is these Labels ?
If it is within the ascx, and you are trying to access it from codebehind of the page where you have added this ascx control, then you would not find the controls directly.
You need to expose them using a property and then use that to set it.
|
|
|
|
|
Thanks..
I restarted my VS twice, yes twice.. !! as the first time it still had same problem.
and then went home for the day. It's working today when I restarted.. grrrrrrrr....
Many Thanks to all.
|
|
|
|
|
Hi All,
I am a newbie to ASP.NET and in need of you help, basically, I have a gridview that binded from two functions (type datatable). One function is parent which I past one parameter ("DeptID") while loading this table I also called the child funtion which get the parameter from the parent function ("FolderID"). The grid bind fine, but my tast is to place a down arrow at the first child row under the parent and an a up arrow at the last child row and the process repeated for each parent that have one or more rows.
This is where I have been banging head head trying to get this work but has no success.
Parent row data1
Down arrow Child row data - first row
up/down arrow Child row data
up/down arrow Child row data
up/down arrow Child row data
up arrow Child row data - last row
Parent row data2
Down arrow Child row data - first row
up/down arrow Child row data
up/down arrow Child row data
up arrow Child row data - last row
Parent row data3
Down arrow Child row data - first row
up/down arrow Child row data
up arrow Child row data - last row
Parent row data4
Child row data - first row
Any assistance is greatly apprecaited. please provide codes example.
Thanks
DocHoliday.
Here are my codes behind VB:
Protected Sub DisplayParentGV()
Dim Conn As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("mConn").ToString)
Dim SQLCmd As New SqlCommand("Get_Links_Name", conn)
Dim SQLDBDataReader As SqlClient.SqlDataReader
Dim dt As New DataTable()
Try
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
SQLCmd.CommandType = CommandType.StoredProcedure
SQLCmd.Connection = conn
SQLCmd.Parameters.Add("@DeptID", SqlDbType.Int, 60).Value = Convert.ToInt32(Session("Dept_id"))
dt.Columns.Add(New DataColumn("FolderID", GetType(String)))
dt.Columns.Add(New DataColumn("FolderFileID", GetType(String)))
dt.Columns.Add(New DataColumn("ImageType", GetType(String)))
dt.Columns.Add(New DataColumn("Page", GetType(String)))
dt.Columns.Add(New DataColumn("FolderOrder", GetType(String)))
dt.Columns.Add(New DataColumn("Link_FileOrder", GetType(String)))
SQLDBDataReader = SQLCmd.ExecuteReader()
While SQLDBDataReader.Read()
Dim dr As DataRow = dt.NewRow()
Dim Pid As Integer = Convert.ToInt32(SQLDBDataReader("FolderID"))
dr("FolderID") = (SQLDBDataReader("FolderID"))
dr("FolderFileID") = Nothing
dr("ImageType") = Nothing
dr("Page") = (SQLDBDataReader("Foldername"))
dr("FolderOrder") = (SQLDBDataReader("FolderOrder"))
dr("Link_FileOrder") = Nothing
Session("ParentBottonRow") = dt.Rows.Count
dt.Rows.Add(dr)
Dim ChildTable As DataTable = DisplayChildGV(Pid.ToString())
For Each dro As DataRow In ChildTable.Rows
Dim dr2 As DataRow = dt.NewRow()
dr2("FolderFileID") = dro("FolderFileID")
dr2("ImageType") = dro("ImageType")
dr2("Page") = dro("Link_FileName")
dr2("Link_FileOrder") = dro("Link_FileOrder")
dt.Rows.Add(dr2)
Next
End While
SQLDBDataReader.Close()
Catch ex As Exception
Throw
Finally
SQLCmd.Dispose()
gvParent.DataSource = dt
gvParent.DataBind()
conn.Close()
End Try
End Sub
Protected Function DisplayChildGV(ByVal FolderID As String) As DataTable
Dim Con As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("mConn").ToString)
Dim dt As New DataTable()
dt.Columns.Add(New DataColumn("FolderFileID", GetType(String)))
dt.Columns.Add(New DataColumn("ImageType", GetType(String)))
dt.Columns.Add(New DataColumn("Link_FileName", GetType(String)))
dt.Columns.Add(New DataColumn("Link_FileOrder", GetType(String)))
Dim SQLCmd2 As New SqlCommand("Get_Links_Folder_Name", Con)
Try
If Con.State = ConnectionState.Closed Then
Con.Open()
End If
SQLCmd2.CommandType = CommandType.StoredProcedure
SQLCmd2.Connection = Con
SQLCmd2.Parameters.Add("@FolderID", SqlDbType.Int, 60).Value = Convert.ToInt32(FolderID)
Dim SQLDBDataReader2 As SqlClient.SqlDataReader = SQLCmd2.ExecuteReader()
'SQLDBDataReader2 = SQLCmd2.ExecuteReader()
While SQLDBDataReader2.Read()
Dim dr2 As DataRow = dt.NewRow()
dr2("FolderFileID") = SQLDBDataReader2("FolderFileID")
If Not IsDBNull(SQLDBDataReader2("LinkURL")) Then
dr2("ImageType") = ResolveUrl("~/Images/icon-ie.gif")
Else
Select Case Mid(SQLDBDataReader2("Link_FileName"), InStrRev(SQLDBDataReader2("Link_FileName"), "."))
Case ".xls"
dr2("ImageType") = ResolveUrl("~/Images/icon-xls.gif")
Case ".doc"
dr2("ImageType") = ResolveUrl("~/Images/icon-doc.gif")
Case ".pdf"
dr2("ImageType") = ResolveUrl("~/Images/icon-pdf.gif")
Case ".ppt"
dr2("ImageType") = ResolveUrl("~/Images/icon-ppt.gif")
Case ".txt"
dr2("ImageType") = ResolveUrl("~/Images/icon-text.gif")
End Select
End If
dr2("Link_FileName") = SQLDBDataReader2("Link_FileName")
dr2("Link_FileName") = SQLDBDataReader2("Link_FileName")
dr2("Link_FileOrder") = SQLDBDataReader2("Link_FileOrder")
Session("ChildBottonRowBolean") = SQLDBDataReader2.Read().ToString
dt.Rows.Add(dr2)
End While
Return dt
Catch ex As Exception
Throw
Finally
SQLCmd2.Dispose()
'gvParent.DataSource = dt
'gvParent.DataBind()
Con.Close()
End Try
End Function
|
|
|
|
|
Why do you require to deal with first and last row when you can easily do this using
You might consider asp:repeater which already has HeaderTemplate and FooterTemplate to deal with just this.
|
|
|
|
|
Does repeater have the same function as gridview does ?
|
|
|
|
|
I need to get the first and last row because my page allow user to move the order of the child row up/down. Therefore, if the child row is first row then user cannot move it up and same for last row, user cannot move it down.
|
|
|
|
|
Yes ... Repeater has that option. Acutally everything in repeater is created by you. Just use PageDataSource to handle paging. Place values in ViewState and use HeaderTemplate and FooterTemplate to have first and last row.
You might give it a try...
|
|
|
|
|
|
Hello every1
im have a RUNNIG website on a REMOTE SEREVER sometimes i get bad results ,i want to trace my Variables to know thier values at a particular point, here is a list of things i've tried :
1. Response.write() ----not working
2. Trace ="True" ---not working properly i cant show actual values ,especially outside the page for instance in a user control or Class.vb
3.Remote debugging -----the remote site doesnt even open i get this error message
The Web server does not appear to have FrontPage Server Extensions ...
when i tried configuering the IIS in order to add frontpage 2002 , the wizard asked me for Windows Server 2003, i don have any
Is there a way out? Please Please Please Help?
modified on Saturday, December 5, 2009 12:40 AM
|
|
|
|
|
Do error logging
Please don't forget to mark 'Good Answer', if you find it really a good one!
Kashif
|
|
|
|
|
I have created a user control that uses an AJAX extender. The problem is when I place the user control on a page a rectangle shaped CalendarExtender icon is shown in the designer. This moves other controls out of place in the designer making it hard get things lined up correctly. When the page runs the CalendarExtender icon is not shown but how can I removed it in the designer?
|
|
|
|
|
Why do you use Designer?
I think using it will end up creating unnecessary codes. use html to define design.
|
|
|
|
|
Hi all,
I am a beginner in javascript, and now I am trying to use it to check validation for an aspx page. I have a button and a textbox. When the button is clicked, the textbox will be checked wether it is empty or not.
I use the following code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" runat="server">
function checkValue2( obj)
{
if (obj.value == "")
alert ("empty");
else
alert ("not empty");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" onclick='checkValue2(forms[0].TextBox1)' />
</div>
</form>
</body>
</html>
And this is the error:
Compiler Error Message: CS1001: Identifier expected
Source Error:
Line 7: <title>Untitled Page</title>
Line 8: <script type="text/javascript" runat="server">
Line 9: function checkValue2( obj)Line 10: {
Line 11: if (obj.value == "")
Could you tell me how can I fix this error?
Thank kiu so much!
|
|
|
|
|
Member 4704143 wrote: When the button is clicked, the textbox will be checked wether it is empty or not.
Member 4704143 wrote: <asp:button id="Button1" runat="server" text="Button" onclick="checkValue2(forms[0].TextBox1)">
Try This :
var TextID="<%TextBox1.ClientID")";
function checkValue2()
{
Var ClientTextID= document.getElementByID(TextID);
if(ClientTextID.value='')
{
alert('text box is null);
}
else
{
alert('text box is not null);
}
}
Please check the syntax.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Suggested change should be done in OnClientClick Event
<asp:Button ID="Button1" runat="server" Text="Button"
OnClientClick='checkValue2(forms[0].TextBox1)' />
|
|
|
|
|
I have placed it in my code as following
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" runat="server">
var TextID="<%TextBox1.ClientID")";
function checkValue2()
{
Var ClientTextID= document.getElementByID(TextID);
if(ClientTextID.value='')
{
alert('text box is null);
}
else
{
alert('text box is not null);
}
}
</script>
</head>
But it seems to be wrong?
|
|
|
|
|
Member 4704143 wrote: But it seems to be wrong?
What seems to be wrong ? Any error ? I have already told you please check the syntax.
Member 4704143 wrote: var TextID="<%TextBox1.ClientID")";
var TextID="<%TextBox1.ClientID%>";
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hey.. he made script runat=server
That means it will not defined as Javascript.
|
|
|
|
|
Abhishek Sur wrote: Hey.. he made script runat=server
That means it will not defined as Javascript.
I haven't Noticed that !
Thanks Abhishek !!
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Abhijit Jana wrote: Thanks Abhishek !!
Cheers.
|
|
|
|
|
The only problem that I see in your code is runat="server" in the script block.
If you specify a script block as runat="server" it will take it as C# / VB.NET block based on the language.
So remove the runat = server and also use
OnClientClick to define javascript block.
use this :
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:checkValue2(this)" />
<script type="text/javascript" >
function checkValue2( obj)
{
if (obj.value == "")
alert ("empty");
else
alert ("not empty");
}
</script>
this will work.
|
|
|
|
|
Yep ... It worked! Thank kiu so much!
|
|
|
|