|
But without links in head section, CSS styles disappears completely, at least in design view. I never tested it further.
It is ugly to avoid design view of the page with CSS styles applied.
Unless you include stylesheettheme property in the page directive it will not work.
Чесноков
|
|
|
|
|
Hey... Dont worry about the Design View.
I dont see design view for such a long time. Just run your application and see if it outputs properly.
In this way you can also change the html, or CSS style and refresh the browser to see the effect.
Design view always hurts me ... Its not perfect, as even the same page may sometimes appear completely different in different browsers... It is hard to rely on design view.
I suggest you to run the site in different browser to see what exactly the problem with the design.. Dont worry about the design view. Leave it whatever is there. Just the thing is to create most sophisticated design with less html generated. ..
cheers.
|
|
|
|
|
ctrl + F5 you mean running without debugging? it does not work also.
Чесноков
|
|
|
|
|
Hi, I have a quick question.
Can an ASP server control have normal HTML elements? I need to have controls that just run Javascript functions. Or is that what an ASP ajax server control is for?
Shot
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
roguemat wrote: I need to have controls that just run Javascript functions.
They only you can use HTML Control. You don't not need to use any server side control.
You can also call the javascript function using Server side control too.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
roguemat wrote: Can an ASP server control have normal HTML elements?
Yes. Actually when you are using ASP.NET server control, its main motive is to generate HTML which is understood by the browser. It generates HTML just which is written in its Render Method. You can easily create a custom web control, and override the render method to generate your own html.
roguemat wrote: I need to have controls that just run Javascript functions.
If you really want to run a javascript, you can directly write this on the page. Or you can use RegisterStartupScript function. . No need to write a server control for that.
roguemat wrote: Or is that what an ASP ajax server control is for?
ASP.NET ajax server controls are those which renders a combination of HTML and Javascript which gives you partial update functionality. If you consider UpdatePanel , it creates a new form element using javascript, copies all the elements(including viewstate ) in that form and then submits it, when you call for server. You can use Fiddler to see what is in request when you call server through update panel.
Thus in one word :
You can use ASP.NET server control to create normal HTML, Normal JAVASCRIPT, CSS, HTML etc. (or combination of all). Validators, scriptManager create only javascript in the page while TEXTBOX, DROPDOWN creates only HTML elements.
Hope you got the idea clearly.
|
|
|
|
|
Thanks for the answer.
I think ive misunderstood something. See, what Im looking for is something like a windows forms custom control, but for ASP. Take for example I created a "calculator" control, I want to be able to just drag it onto any asp form in VS. Added to that the calculator must not run postbacks etc(hence why I said html controls on it), and instead, for example, just run a javascript function with the answer.
Thanks
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
Yes this is cool.
The only thing that you have to do, is to create a custom control and override Render method and create the HTML for you.
This[^] might be helpful
|
|
|
|
|
Hello all,
I want to know, can we insert multiple records at the same time using any method of SqlCommand class?
If this is possible then how can we achieve it?
Thanks,
Nagendra.
|
|
|
|
|
SQLCommand does not tackle this as it is only resposible for passing on the execution statement to the server.
Here [^]is a nice article for doing this.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi You can use BatchUpdate for this
try
{
Craete SQL COmmand Object
cmd.CommandType = CommandType.StoredProcedure;
cmd.UpdatedRowSource = UpdateRowSource.None;
cmd.Parameters.Add("@Param1", SqlDbType.Int, 4, argDt.Columns[0].ColumnName);
cmd.Parameters.Add("@Pram2", SqlDbType.Bit, 5, argDt.Columns[1].ColumnName);
cmd.CommandTimeout = 0;
SqlDataAdapter da = new SqlDataAdapter();
da.InsertCommand = cmd;
da.UpdateBatchSize = 100;
conn.Open();
int recordsInserted = da.Update(argDt);
conn.Close();
}
Inderjeet Kaur
Sr. Software Engg
|
|
|
|
|
I am creating a mp3 player through C#.Net I have kept a CheckBox that shows the play list. I have created the player such that it when ever the user cicks on the selection on checkbox the player play the corresponding song. so the user has to click on the next song to play the next song once the previous song is finished.
Now I would like to know is it possible for the player to automatically play the next song once the previous song is finished? If so how do I go about doing this on C#.Net
Please let me know... Thanks!
|
|
|
|
|
I think you can create a player using Flash or Silverlight. You can manipulate them using javascript and the logic you write.
Dont rely on ActiveX controls that plays sound as they only work in IE.
|
|
|
|
|
Hi,
i designed an asp.net site and uploaded it to www.somee.com[^]
but when i run my site
this error appear to me
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
please help me
thx
BESHOY
FACULTY OF COMPUTER AND INFORMATION
COMPUTER SCINCE DEPARTMENT
|
|
|
|
|
BESHOY MARKO wrote: FACULTY OF COMPUTER AND INFORMATION
COMPUTER SCINCE DEPARTMENT
FACULTY?? And you have to ask how to solve this problem
We see far too many of your students here.
only two letters away from being an asset
|
|
|
|
|
This may occur for anything.
I think there must be some permission issue with the website. You can also check if the path of the virtual directory is correct. Means it should point to the location where it finds Web.config.
You can also debug your application to see what exactly the error occurring.
It is very hard to tell you the error as this page comes everytime when a call is made remotely and error is produced while processing child request.
|
|
|
|
|
i think ur web.config is not properly uploaded or some file data missing while uploading ur website
|
|
|
|
|
Hi,
I have a user control housing a datalist displaying products.
The idea is to have a link on each of the products that takes you to an exploded view of the product.
If I drag the user control to a page and set a DisplayedProducts property the products are displayed, and the ItemCommand fires fine.
However, if I create the user control through code and add it to a ContentPlaceHolder the ItemCommand does not fire...
heres the code that adds the control...
Control productListViewerLoad = LoadControl("Controls/ProductListViewier.ascx");
Controls_ProductListViewier productListViewer = (Controls_ProductListViewier)productListViewerLoad;
_Products = BLL.ProductBLL.GetByCategory(categoryID, false);
productListViewer.DisplayedProducts = _Products;
productHolder.Controls.Clear();
productHolder.Controls.Add(productListViewer);
Any ideas as to how I can get the ItemCommand to fire??
Thanks,
Chas
|
|
|
|
|
where is the Handler added in your page ?
like
productListViewer.ItemCommand += new ...
The line should be specified, I think.
|
|
|
|
|
This is specified in the control
<asp:DataList ID="dlProducts" runat="server" RepeatColumns="2" OnItemCommand="dlProducts_ItemCommand2">
(Its the control I add to the holder, not the datalist itself)
|
|
|
|
|
you mean even you declared dlProducts_ItemCommand2 in your code behind, it is not calling properly. This is weird.
It should be calling when event is generated in the client and which results in postback..
Check your code thoroughly, I think there must be some very trivial mistaken made in your code. Or you can show us the Code you wrote....
|
|
|
|
|
heres the control ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProductListViewier.ascx.cs" Inherits="Controls_ProductListViewier" %>
<asp:DataList ID="dlProducts" runat="server" RepeatColumns="2" OnItemCommand="dlProducts_ItemCommand2">
<ItemTemplate>
<table style="padding:12px">
<tr>
<td>
<table>
<tr>
<td class="productdetail" colspan="2">
<%#DataBinder.Eval(Container.DataItem,"Name")%>
</td>
</tr>
<tr>
<td class="productdetailheading">
PRODUCT CODE:
</td>
<td class="productdetail">
<%#DataBinder.Eval(Container.DataItem, "ProductCode")%>
</td>
</tr>
<tr>
<td class="productdetailheading">
DISPOSE/ REUSE:
</td>
<td class="productdetail">
<%#DataBinder.Eval(Container.DataItem, "DisposeReuse")%>
</td>
</tr>
<tr>
<td class="productdetaillink" colspan="2">
<asp:LinkButton ID="btnShowProduct" runat="server" Text="Show Product Details" CommandArgument='<%#DataBinder.Eval(Container.DataItem, "ProductID")%>' CommandName="ShowProductDetails" />
</td>
</tr>
</table>
</td>
<td>
<img alt="Image" style="height:100px; width:100px;" src="HttpHandlers/ImageHandler.ashx?productid=<%#DataBinder.Eval(Container.DataItem,"ProductID") %>"/>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
and the code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataLinq;
using BLL = BusinesLogic;
public partial class Controls_ProductListViewier : System.Web.UI.UserControl
{
private List<Product> _DisplayedProducts;
public List<Product> DisplayedProducts
{
get
{
return _DisplayedProducts;
}
set
{
_DisplayedProducts = value;
dlProducts.DataSource = _DisplayedProducts;
dlProducts.DataBind();
}
}
public delegate void ProductSelectHandler(Product product);
public event ProductSelectHandler ProductSelected;
private void OnProductSelected(Product product)
{
if (ProductSelected != null)
{
ProductSelected(product);
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void dlProducts_ItemCommand2(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "ShowProductDetails")
{
int selectedProductID = 0;
if (Int32.TryParse(e.CommandArgument.ToString(), out selectedProductID))
{
Product selectedProduct =
(from product in DisplayedProducts
where product.ProductID == selectedProductID
select product).Single();
OnProductSelected(selectedProduct);
}
}
}
}
The point is this works fine until i load the control dynamically into a place holder.
I want to use the same page (thats within a master page) to display the product listing, then when a product is selected the control publishes an event - the page receives this event, clears the place holder then displays the product details (loads a product display control into the holder)...
modified on Saturday, August 29, 2009 7:24 PM
|
|
|
|
|
Ok managed to find a fix...
The problem was that as the control was generated dynamically, on clicking on the link button the page would refresh, on its refresh the control was not created, so the link button didnt exist. I googled this for hours and the more I read about it the more I was told that its an EnableViewState issue (assuming enable view state would ensure the control exists after refreshes) - I enabled view state on the master page, the place holder on the master page, the page directive, the content holder on the page, the content holder that i populate dynamically, the user control, the data list within the control... still when the page refreshed the dynamically loaded content was always lost... any ideas on this?
Anyway to hack around this - when i set the datasource for the datalist i store it in a session parameter.
Then override OnInit on the page - and if the session parameter exists then recreate the control first. This has got it working but its a hack that I dont like.
|
|
|
|
|
I have already saw your code and it seemed to me fine. Yes, you need to EnableViewState when you want the control to appear during postbacks.
Chazzysb wrote: when i set the datasource for the datalist i store it in a session parameter
I suggest you to dont do that. Dont use Session to store datasource, as heavy data will eat up application pool memory. Rather
Use Fiddler to check what exactly the response generated. Check what exactly the problem is during the postbacks.
|
|
|
|
|
I have a site with fileupload control and some textboxes.
I want to collect data from these controls to a sql server(2005) connection.
Please Help me.
If anyone has an article please type that link.
|
|
|
|