|
1. WebForm1.aspx
2. Koledar.aspx
HTML code
A onclick="window.open('Koledar.aspx?textbox=TextBox1','cal','width=220,height=205,left=270,top=180' )" href="javascript:void(0)"> asp:ImageButton id="ImageButton1" style="Z-INDEX: 102; LEFT: 288px; POSITION: absolute; TOP: 24px" runat="server">";
RegisterClientScriptBlock("Calendar_ChangeDate", strScript);
}
}
|
|
|
|
|
thnx for this
but i m not using calandar control.
i want to mekae in javascript only
So plz help
|
|
|
|
|
In my Page_Load method, I open up a text file (which populates an asp:label further down the page - not sure if this is the best way of doing this but anyway).
This works fine on my local machine, however it breaks down when running online:
http://www.sharedigest.com/options/Default.aspx[^]
I have tried fiddling with the security settings of the .txt file in windows explorer (and then upload to server) but this makes no difference.
If anyone has advice on how to get around this security-related problem, it'll be highly appreciated!!
Gerry
asp.net newbie
|
|
|
|
|
Try creating a new directory inside your app, call it whatever (file_storage). Adjust your code so it points to the new path. This alone may correct the issue. If this does not correct the issue, then I would say something is off with your web.config or the IIS settings.
This is really not the best method or storage option either, you may want to consider using an XML file instead if you do not have any database options.
Also, you can simplify your code a bit:
Dim sr As New System.IO.StreamReader("yourPathAndFile")
LabelSomething.Text = sr.ReadToEnd()
sr.Close()
Always make sure to close the file as well, you may want to implement a try ..catch around file operations and ensure you close them in the finally block.
EDIT - also, if its just the ad words your trying to include on the page from the text file, you may want to build a simple control that you can use on all of your pages.
-- modified at 21:38 Tuesday 24th July, 2007
|
|
|
|
|
Hi there,
Creating the directory still doesn't work:
http://www.sharedigest.com/options/Default.aspx
Yeah I was wondering: there's gotto be a more elegant way to include generic pieces of html / javascript / whatever into pages.
Is this what controls are about? Dang I am so new to this it aint funny lol.
Ie. if I have a piece of code, say a small table
... and I want to include that in many different pages, can I do that?
Many thanks for your help,
Gerry
fresh from windows app creation world
|
|
|
|
|
But yeah its pretty worrying that one can't open a file on your own server?!
Perhaps it needs to be in a special folder?
G
|
|
|
|
|
You might want to look at using master pages with .net 2.0. With them, you define a template page (the master) that all of your (content) pages use. Regardless if you use master pages or the older method (includes, etc..), if you have something that needs to be on every page (like a navigation menu), then I would embed it.
If you have something that only needs to be on one or two pages, I would write code for those specific pages to get it on the page. If you will have the need to share this "block" of code on many pages but not all of them, or just for certain users, I would make it a user control.
A user control can be simple (what you currently need) or very complex, that all depends on you and your needs.
Hope this helps.
|
|
|
|
|
Hi doWhileSomething,
I am in fact already using a master page.
I would like to use a generic piece of html code in certain sections of pages, but not necessarily the SAME areas (else this could prob be done nicely with the master page).
Just a simple piece of html being 'included' (like with php, if I want to conditionally include a piece of code, simply do: if($yesPleaseIncludeAdsenseHere == true){ include "inc/adsense.php"; }) in certain areas, like such:
Page1.aspx:
- -- - - -
table...stuff stuff
INCLUDE section (html / javascript) *
stuff stuff blah blah
- - - - - -
Page2.aspx
- - - - - - -
stuff stuff blah
more stuff stuff
html table or whatever blah blah
INCLUDE section (html / javascript) *
- - - - - - -
* perhaps i can create this section in a seperate html file and simply do Response.WriteFile("includeFile.html") eh?
Cheerio,
Gerry
|
|
|
|
|
Creating a user control IMO is certainly the way to go and master pages in most ways will simplify the entire project. With a user control, you could put it where every you want, whenever you want and maintain just the one code stub that resides in the user control (basically a fancy include).
You can add your control to the page at design time or run time wrapped in a conditional statement. I would say loading it at run time is the best method though if your not always going to make it visible on a given page. With this, you can just call a method based off of your criteria.
e.g. record in a db, certain browser restrictions, cookies, etc..
Another option is to place the contents in a panel and just toggle the visibility of the panel (or any control), but this is probably the least desired way of achieving your goal.
|
|
|
|
|
Hi there,
I tried using a label and then programmatically setting its content in the Page_Load() method (so i check the contents of the label and then, depending on what it is, set it to some html).
The problem comes in when trying to set the text equal to javascript: since the word "" occurs in the javascript itself, regardless of whether its specified in a string, VS reads it as the end of the asp tag!
but besides this problem, i need to have ONE place which contains the generic code, therefore im just doing Respose.WriteFile("adsense/adOne.html") (which contains the javascript for adsense) and that doesn't seem to have the same file access error that FileStream produces!
weird...
G
<div class="ForumSig">Learn How to Make $ With Domains
<a href="http://www.dntutor.com/intro">http://www.dntutor.com</a></div>
|
|
|
|
|
If your hell bent on not creating a control, and want to dynamically add the script, you should take a look at the page.registerstartupscript method. http://msdn2.microsoft.com/en-us/library/system.web.ui.page.registerstartupscript.aspx[^]
Also, get rid of the label control, for stuff like this (raw text/HTML) using a literal control is a much better option. It has no mark up tags once rendered to the browser. The label control renders its text between "span" tags. (FYI).
If your simply not sure how to create a control and want some help with it, just ask. I have no problem taking a few minutes to help you with it.
|
|
|
|
|
hi there doWhileSomething,
yeah i would very much like to learn about a literal control.
I'm not hell-bent on not using a control (in fact i'd prefer to use one!). But just as a reference, here's the code im currently using (which works quite well, but what would be better is if I could load in an html file and populate the contents of a control with it in the Page_Load function, since currently the the label already has text, so if for some reason the html file doesn't write, there will be text on the page
<br />
<br />
<div class="adsense" align="center"><br />
<asp:Label ID="adsenseLabel" runat="server" Text="gvt"> <br />
<br />
<%<br />
if(adsenseLabel.Text == "ab")<br />
Response.WriteFile(ResolveClientUrl("~/adsense/as_articleBottom_ab.html"));<br />
else<br />
Response.WriteFile(ResolveClientUrl("~/adsense/as_articleBottom_gvt.html")); <br />
%><br />
<br />
</asp:Label><br />
</div><br />
<br />
|
|
|
|
|
how does script language to use my function exposed by IDispatch?for Example:there is a function declare as: long add(long n1,long n2),the script how to call this function?
Later buggers harm more.
|
|
|
|
|
I have checkboxes on my website and I want to do the following:
* change the color of the check in the checkbox
* change the border color of the checkbox
* change the size of the checkbox
* left align the edge of the checkbox with the other controls on my page
All of my chages refer to the little square checkbox it's self and not the entire control.
Can you please tell me if it is possible and if not what the alternatives are?
Thank you.
|
|
|
|
|
I am pretty sure you cannot change the size. As to the others, the best place to look is to read up on html, at the end of the day, what you're asking doesn't have anything to do with ASP.NET, you need to know if a browser is able to show checkboxes with different colors.
Aligning them is up to you, you can use tables or CSS to position your controls.
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 )
|
|
|
|
|
Thanks for the reply but it still doesn't answer my question. I have done a bunch of research on this issue and can't seem to be able to find the answer for, checkboxes specifically, any where.
|
|
|
|
|
use css can solve it!
allways study
|
|
|
|
|
I wouldn't have asked the question if the answer was css. I know enough to read the basic books on HTML and there is no answer in any of them to my question. If you don't have a specific answer to my question please don't insult my intelligance with stupid answers.
|
|
|
|
|
Hello
I work with repeater where i use the a dataset to fill it.
I want to put a row at the top of the repeater but taken the same long as the repeater and the text inside will b from the data Set
can someone help me to do that
Thanks in advance
Assaf
|
|
|
|
|
Start a table outside the dataset, with the first row. Close it after the repeater.
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 )
|
|
|
|
|
I'm Sorry but this don't work
this my code:
<asp:repeater id="myRepeater" runat="server">
<headertemplate>
<itemtemplate>
<alternatingitemtemplate>
<footertemplate>
<%#DataBinder.Eval(Container.DataItem, "GradeName")%> | Grade Name | Institution Name | AcomplishesYear | Date of Graduation | Grade | <%#DataBinder.Eval(Container.DataItem, "GradeName")%> | <%#DataBinder.Eval(Container.DataItem, "InstitutionName")%> | <%#DataBinder.Eval(Container.DataItem, "AccomplishYearNum")%> | <%#DataBinder.Eval(Container.DataItem, "DateOfGraduation")%> | <%#DataBinder.Eval(Container.DataItem, "Grade")%> | <%#DataBinder.Eval(Container.DataItem, "GradeName")%> | <%#DataBinder.Eval(Container.DataItem, "InstitutionName")%> | <%#DataBinder.Eval(Container.DataItem, "AccomplishYearNum")%> | <%#DataBinder.Eval(Container.DataItem, "DateOfGraduation")%> | <%#DataBinder.Eval(Container.DataItem, "Grade")%> |
Thanks you in advance
Assaf
|
|
|
|
|
1 - you need to define 'doesn't work' so people know what your problem is.
2 - There's no data item to evaluate in the header or footer.
3 - I don't see you creating a footer item, or even a main template, is there code missing ?
4 - I assume all of this is inside a repeater, you didn't post that code.
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 )
|
|
|
|
|
I work with repeater where i use the a dataset to fill it.
I define the DataAdapter And the dataSet in the Vb Code
I want to put a row at the top of the repeater but taken the same long as the repeater and the text inside will be from the data Set
this the Html code:
<asp:repeater id="myRepeater" runat="server">
<headertemplate>
<itemtemplate>
<alternatingitemtemplate>
<footertemplate>
<%#DataBinder.Eval(Container.DataItem, "GradeName")%> | Grade Name | Institution Name | AcomplishesYear | Date of Graduation | Grade | <%#DataBinder.Eval(Container.DataItem, "GradeName")%> | <%#DataBinder.Eval(Container.DataItem, "InstitutionName")%> | <%#DataBinder.Eval(Container.DataItem, "AccomplishYearNum")%> | <%#DataBinder.Eval(Container.DataItem, "DateOfGraduation")%> | <%#DataBinder.Eval(Container.DataItem, "Grade")%> | <%#DataBinder.Eval(Container.DataItem, "GradeName")%> | <%#DataBinder.Eval(Container.DataItem, "InstitutionName")%> | <%#DataBinder.Eval(Container.DataItem, "AccomplishYearNum")%> | <%#DataBinder.Eval(Container.DataItem, "DateOfGraduation")%> | <%#DataBinder.Eval(Container.DataItem, "Grade")%> |
can someone help me to do that
Thanks in advance
Assaf
|
|
|
|
|
OK.
1 - you cannot get data from the dataset in your header. Where do you expect it to come from ( what row ? )
2 - this code is defining a table with two rows. The whole point of a repeater is that you define a template for a single row, and the repeater iterates over the rows of your data source, using the template each time.
3 - Nothing you've done here is likely to do anything much at all. It seems you're hopelessly lost, you should read up on the repeater control, on MSDN perhaps, so you understand the tool you're trying to use.
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 )
|
|
|
|
|
Hi,
I'm using vb.net 2.0 and attempting to load a gridview with my access database. And then update the gridview and the database with a series of dropdowns (I'm starting with one dropdown until I get that one working). I've been told via many sites it's possible with the aspx page and no actual coding in 2.0 but I've been unsuccessful. PLEASE HELP!
<asp:GridView ID="GridView1" runat="server" CellPadding="4" DataSourceID="FlashlightDS"
ForeColor="#333333" GridLines="None" AutoGenerateColumns="False">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="ORGCODE" HeaderText="Org" SortExpression="ORGCODE" />
<asp:BoundField DataField="SEGMENT1" HeaderText="Item Number" SortExpression="SEGMENT1" />
<asp:BoundField DataField="ITEM_TYPE" HeaderText="Item Type" SortExpression="ITEM_TYPE" />
<asp:BoundField DataField="INVITMSTAT" HeaderText="Item Status" SortExpression="INVITMSTAT" />
<asp:BoundField DataField="PLNRCDE" HeaderText="Planner Code" SortExpression="PLNRCDE" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="FlashlightDS" runat="server" ConnectionString="<%$ ConnectionStrings:AccessFlashlightConnectionString %>"
ProviderName="<%$ ConnectionStrings:AccessFlashlightConnectionString.ProviderName %>"
SelectCommand="SELECT ORGCODE, SEGMENT1, ITEM_TYPE , INVITMSTAT , PLNRCDE FROM OrgItems WHERE (ENGITM = 'N') AND (PLNMKBY = 'Buy') AND (MRPPLNCD = 'MRP planning') AND (SOURCE_TYPE = '2') AND (WIP_SUPPLY_SUBINVENTORY <> 'PRP') AND (ITEM_TYPE=@ITEM_TYPE) ORDER BY SEGMENT1"
UpdateCommand="UPDATE [OrgItems] SET [ORGCODE] = @ORGCODE, [SEGMENT1] = @SEGMENT1, [INVITMSTAT] = @INVITMSTAT, [PLNRCDE] = @PLNRCDE [ENGITM] = 'N' AND [PLNMKBY] = 'Buy' AND [MRPPLNCD] = 'MRP planning' AND [SOURCE_TYPE] = '2' AND [WIP_SUPPLY_SUBINVENTORY] <> 'PRP' AND [ITEM_TYPE]=@ITEM_TYPE ORDER BY SEGMENT1">
<SelectParameters>
<asp:ControlParameter Name="ITEM_TYPE" ControlID="ddItemType" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="ORGCODE" />
<asp:Parameter Name="SEGMENT1" />
<asp:Parameter Name="INVITMSTAT" />
<asp:Parameter Name="PLNRCDE" />
</UpdateParameters>
</asp:SqlDataSource>
-----------------------
When I remove the last part of the where clause from my select statement in my select command, the gridview will appear on the page (won't appear otherwise) but the dropdown is useless. I have been working on this simple task for WEEKS unsuccessfully and I really need help. Thanks in advance to anyone who is smarter than me
|
|
|
|
|