Showing posts with label view. Show all posts
Showing posts with label view. Show all posts

Wednesday, March 28, 2012

view images through xml

I am trying to create a slideshow that has some text and an image. I am able to scroll through the xml file and display the text elements. My problem is with the images. Can anyone help? Thanks

XML:

<?xml version="1.0" encoding="iso-8859-1" ?>
<dogs>
<info>
<name>Archer</name>
<handler>P.O. 1</handler>
<skills>Drugs</skills>
<birthday>4</birthday>
<imagesrc>Images/K9/Dogs/Archer.jpg</imagesrc>
</info>

code:

<xml src="http://pics.10026.com/?src=XML/dogs.xml" id="xmldso" async="false"></xml>

<table width="100%">
<tr>
<td style="width:50%;" align="right">
<span datasrc="#xmldso" datafld="imagesrc"></span>
</td>
<td style="width:50%;" align="left">
<table style="border: activeborder 1px solid">
<tr><td class="TableBottom" width="70">Name:</td><td class="TableBottom" width="100"><span datasrc="#xmldso" datafld="name"></span></td></tr>
<tr><td class="TableBottom" width="70">Handler:</td><td class="TableBottom" width="100"><span datasrc="#xmldso" datafld="handler"></span></td></tr>
<tr><td class="TableBottom" width="70">Skills:</td><td class="TableBottom" width="100"><span datasrc="#xmldso" datafld="skills"></span></td></tr>
<tr><td class="TableBottom" width="70">Birthday:</td><td class="TableBottom" width="100"><span datasrc="#xmldso" datafld="birthday"></span></td></tr>
<tr><td width="70"></td><td width="100"></td></tr>
</table>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<A href="http://links.10026.com/?link=JavaScript:moveprevious()"> Back</A>
|
<A href="http://links.10026.com/?link=JavaScript:movenext()"> Next</A>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<INPUT TYPE="text" WIDTH="100" NAME="Number" style="border:0; text-align:center;">
</td>
</tr>
</table>

<SCRIPT LANGUAGE="JavaScript">

function Start()
{
x=xmldso.recordset;
document.Canine.Number.value=x.absoluteposition+" of "+x.recordcount;
// document.getElementById("mypic").src =x.recordset("imagesrc") ;
}

function movenext()
{
x=xmldso.recordset;

if (x.absoluteposition < x.recordcount)
{x.movenext();}
else if (x.absoluteposition = x.recordcount)
{x.movefirst();}

document.Canine.Number.value=eval(x.absoluteposition);
document.Canine.Number.value=x.absoluteposition+" of "+x.recordcount;
}

function moveprevious()
{
x=xmldso.recordset;

if (x.absoluteposition > 1)
{x.moveprevious();}
else if (x.absoluteposition = 1)
{x.movelast();}

document.Canine.Number.value=eval(x.absoluteposition);
document.Canine.Number.value=x.absoluteposition+" of "+x.recordcount;
}

</SCRIPT>

Change this line <span datasrc="#xmldso" datafld="imagesrc"></span>

to <img datasrc="#xmldso" datafld="imagesrc" />

use the img html control instead of the span control. I tested this in my local machine and works fine

let us know

I tired that and did not work. When I scroll through the images, all I get the the missing image with the red x where the image should be.


Well, it should work. do you have the following image?

Images/K9/Dogs/Archer.jpg

right click the red icon and see the image path.


Yes, I have the image. I even moved it to the same folder as the xml file in case the path was not accurate.


Chris,

I am using IE 7 and it works fine. Which browser and what version are you using?


Forget my last comment. It did work. I did not properly refresh the xml file. Thanks for your help. It is appreciated.

View PDF in ATLAS?

In my existing 1.1 app, I have a datagrid with a column that, when clicked, displays a pdf file. In trying to convert it to 2.0 with Atlas, the pdf will not display, no error, but no display either. The data for the pdf is stored in SQL as binary data. I have listed the code below. If anyone could shed some light onto the issue, I'd greatly appreciate it.

If dr.Read Then
Dim byData(dr.GetBytes(0, 0, Nothing, 0, Integer.MaxValue) - 1) As Byte
dr.GetBytes(0, 0, byData, 0, byData.Length)
Response.ClearContent()
Response.ClearHeaders()
Response.Buffer = True
Response.AddHeader("Content-Disposition", "inline;filename=" & strFileName)
Response.AddHeader("Accept-Header", byData.Length)
Response.ContentType = strContentType
Response.BinaryWrite(byData)
Response.Flush()
Response.Close()
End If

Again, any feedback would be appreciated.

Thanks.

I ended up diong the postback in a different page.

What you will need to do is have a link in your datagrid to another page (ie viewattachment.aspx?filename=filename) and then create a non ajax windows form page called viewattachment.aspx

In the viewattachment.aspx page_load method you can then place your response code as you mentioned above

I have written an example of thishere.
Clinton

view problem within cc1:ModalPopupExtender ..

I have a view problem within cc1:ModalPopupExtender .. when I click an asp image button the specified panel located most top-left in a page even I do not use x or y ModalPopupExtender properties

this problem happens only with ie

in firefox everything works fine ..

here is ModalPopupExtender code :

<cc1:ModalPopupExtender ID="ModalPopupExtender3" runat="server"
TargetControlID="submitBuyImgBt"
PopupControlID="Panel1"
BackgroundCssClass="modalBackground"
DropShadow="true"
OkControlID="OkButton"
OnOkScript="onOk()"
CancelControlID="CancelButton" />

any help would be greatly appreciated

why it's position always in top left side of the page ?


what does the css look like for the panel? are you using one?

heres what i always use and it shows up at the center of the screen.

<ajax:ModalPopupExtender ID="mpeEditUserForm" runat="server" TargetControlID="btnEditUser" BackgroundCssClass="modalBackground"
PopupControlID="pnlUserModal" />
<asp:Panel ID="pnlUserModal" runat="server" CssClass="modalPopup" Style="display:none; padding:3px 3px 3px 3px" Width="320px">

css:

.modalBackground
{
background-color:Gray;
filter: alpha(opacity=70);
}
.modalPopup{
background-color:White;
border: solid 3px Gray;
padding: 3px 3px 3px 3px;

font-size:medium;
}


Mezzaluna:

what does the css look like for the panel? are you using one?

heres what i always use and it shows up at the center of the screen.

<ajax:ModalPopupExtender ID="mpeEditUserForm" runat="server" TargetControlID="btnEditUser" BackgroundCssClass="modalBackground"
PopupControlID="pnlUserModal" />
<asp:Panel ID="pnlUserModal" runat="server" CssClass="modalPopup" Style="display:none; padding:3px 3px 3px 3px" Width="320px">

css:

.modalBackground
{
background-color:Gray;
filter: alpha(opacity=70);
}
.modalPopup{
background-color:White;
border: solid 3px Gray;
padding: 3px 3px 3px 3px;

font-size:medium;
}

I have CSS but it's still not working .. but both panel and moalPopupExtender located in a web user control ( .ascx )

does the problem because of this ?

Note that every thing works fine in firefox. however not fine in ie6 or above


Not sure on that then. I always have the opposite problem. I get things to work in IE and they fail in Firefox.


viewing the script source

Previously, the script source was in a ScriptLibrary directory in a web
application. I want to view the source now with the March CTP. Is there a
way to view the source in the clientside javascript now?

Wally

--
Wallace B. McClure
"The Harder I Work, the Luckier I Get."
Listen to "The ASP.NET Podcast" at http://www.aspnetpodcast.com/
Database Award: http://url123.com/vc3er
Microsoft MVP - Visual Developer ASP/ASP.NET
AspInsider
"AJAX for ASP.NET" Coming Soon!
ADO.NET Book: http://url123.com/vc2bu
865-693-3004
118 Durwood Rd.
Knoxville, TN 37922
http://www.scalabledevelopment.com/
Blog: http://weblogs.asp.net/wallym/

Wally, the atlas scripts as now packaged as resources in the atlas dll. The Atlas MSI setup also installs them in the c:\Program Files\Microsoft ASP.NET\Atlas\v2.0.50727\Atlas\ScriptLibrary\Debug\ directory for you to view.

enjoy
-jhawk

Saturday, March 24, 2012

Way to get data from SQLDatasource

Hello,

I have a General question, does anyone know a better way to get data from a SQLDatasource that can be hidden from view? I have a DataView right now and to do anything on it it must be visible and I cant seem to make it disappear. Is there a better way to count rows / Access data without a dataview object? I am using Ajax Update panel to look at the data if that matters.

Thanks!

Not sure what you are asking here... the DataView isn't a "visible" control (http://msdn2.microsoft.com/en-us/library/system.data.dataview.aspx). Did you mean GridView?

What problem are you trying to solve?

-Damien


I have the following code:

Protected Sub Button1_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Button1.Click, Panel5.DataBinding

If Me.IsPostBack()Then
Dim testvalAs Integer =Me.DetailsView1.Rows.Count()
If testval > 0Then
Label1.Visible =True

Label1.Text ="ERROR: The Project Name you have selected is already in use on this team."
Me.Panel5.Height = 24
Me.Panel5.Width = 590

Else
Me.Panel5.Height = 0
Me.Panel5.Width = 0
Label1.Visible =False

End If
End If
End Sub

-----

Basically, when I made the panel, or the Details View hidden it does not work because it always has a count of 0. The details view has to be VISABLE and it shows on my page. What I want to do is be able to find out how many rows (or get a data item) using another way to do the same thing as the above without showing the DATA on the screen to the user. I have databound all of the objects and it works but it just looks ugly. But am having a lot of trouble because its in an update panel which is hidden until this check goes... so I am not quite sure what else I can use to do the above. Any Suggestions? I am new to ASP.NET I am more used to the datasources of the VB.Net where I had a binding datasource that I could access without having to display it on the page. I have not beenable to find that for ASP.NET yet.

Thanks!


Ok, DetailsView, not DataView :) What you want to use is the DataView.

Take a look here:http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=228386&SiteID=1

Specifically the code:

string connectionString = "...Northwind Connection String...";
string selectSql = "SELECT [CategoryID], [CategoryName] FROM [Categories]";

DataSourceSelectArguments args = new DataSourceSelectArguments();

SqlDataSource dataSource = new SqlDataSource(connectionString, selectSql);
DataView view = (DataView)dataSource.Select(args);

You can then use DataView.Count to get the total records, or you can filter the results.

Hope this helps...

-Damien


Hi,

I was able to convert everything above into Visual Basic code but something is giving me the error on line 7:

System.Data.SqlClient.SqlException was unhandled by user code
Class=15
ErrorCode=-2146232060
LineNumber=1
Message="Incorrect syntax near the keyword 'AND'."
Number=156
Procedure=""
Server="SQL112.viux.com"
Source=".Net SqlClient Data Provider"

The code I used is:

1Dim connectionStringAs String ="Data Source=SQL112.viux.com;Initial Catalog=StartPlan;Persist Security Info=True;User ID=user;Password=password"2Dim selectSqlAs String ="SELECT ProjectName FROM Projects WHERE (ProjectName = " +Me.TextBox1.Text.ToString() +" AND (TeamId = " +Me.DropDownList1.SelectedValue.ToString() +") GROUP BY ProjectName"34Dim argsAs DataSourceSelectArguments =New DataSourceSelectArguments()56Dim dataSourceAs SqlDataSource =New SqlDataSource(connectionString, selectSql)7Dim view6As Data.DataView = dataSource.Select(args)89If Me.IsPostBack()Then10 Dim testvalAs Integer = view6.Table.Rows.Count()

Anyone know what is up?

Thanks!


Exactly what it says "Incorrect syntax near the keyword 'AND'"

It should be ") AND (TeamId = " +Me.DropDownList1.SelectedValue.ToString() +") GROUP BY ProjectName"

-Damien


AWESOME! Actually I was missing some extra " ' " marks in there as well. But then it worked after that!!!!

Thanks dude!