asp.net-2.0

Why is ViewState lost when a control's property is modified during its parent's Control.Render method?

I have code like the following in a UserControl: Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter) If someCondition Then childControl.Enabled = false End If MyBase.Render(writer) End Sub Whenever someCondition is true and childControl.Enabled is set to false during the Render event, the ...

.net templates which page am I on?

Hi, I'm curious to know that using .net 2.0 with a master page if there is a way that I can pick up what page I am on so that i can use it to style a tab? My master page has a nav bar on it, and what I wan to do is: If the user is, say on the contact page, that the tab for the contact page would be a different color, can this be achie...

How to upload an image when user selects a file in FileUpload control like in gmail?

Hi all, I need to upload image or file when user selects that file like in gmail attach file without any other asp:button . What I mean is there shouldn't be any other button except fileupload control. And when a file is selected the file will be uploaded to the server folder. How to implement that? Please help. ...

Plaxo integration

Does anyone know of a good integration library for Plaxo and ASP.NET? ...

How to dynamically create CSS class in JavaScript and apply?

I need to create a CSS stylesheet class dynamically in JavaScript and assign it to some HTML elements like - div, table, span, tr, etc and to some controls like asp:Textbox, Dropdownlist and datalist. Is it possible? It would be nice with a sample. ...

How to show images in dropdownlist options?

Hi all, I need to have a dropdownlist whose options contains text followed by a small image. Suppose I have a dropdownlist of fruits. I want to show the options as : Option 1 : small Image of mango then text Mango Option 2 : small Image of orange then text Orange ..................... Is it possible to implement in asp.net 2.0? If ...

HOW TO MAKE localization?

hi all I have a question about localization how can i do localization lets say that i have a dropdown list that holds the available languages: English,french and arabic and I have a label which get it says "good morning",so i want to change the lang. according to selected lang. in drop down list so when the user chooses french label will...

How Do I Get a Dynamic Control's Value after Postback?

I have a listview that adds controls in the ItemDataBound Event. When the postback occurs, I cannot find the new controls. After a bit of research, I found that ASP .NET needs these controls created every time, even after postback. From there I moved the function to bind the ListView outside of the if (!Page.IsPostBack) conditional. ...

Response.AddHeader

why Response.AddHeader is used? ...

File Upload / Memory Stream Security

Hi, We are thinking of have a form on our webpage that would allow people to email attachments through. The method used to do this is via a memory stream, avoiding any files being written on to the actual server. Is anyone aware of any security risks / how to protect yourself against these? I would love to hear from you. Best regard...

Optionally display a text in place of GridView when the GridView has no rows

I have a basic GridView that displays a list of tasks to do (just an example) <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AllowSorting="True" > <Columns> <asp:BoundField DataField="todo" HeaderText="To Do" ReadOnly="True" SortExpression="todo" /> <asp:BoundField DataField="byDate" Header...

How can I prevent ASP.NET from adding to the inline styles?

I have an element that I'm trying to style: <tr runat="server" id="row" > ... </tr> And I set the style programmatically: row.Attributes("style") = "background: #cccccc;" I get this output: <tr id="SearchResults_myRepeaterPlain_ctl04_row" style="background: rgb(204, 204, 204) none repeat scroll 0% 0%; -moz-background-clip: border;...

What is the best procedure to implement paging in a gridview considering size of Record ?

Hi all, I have a table in sq server db having more than 1 million rows. I need to show those data in a gridview with pagination in an asp.net page. Since the record amount is larger I need to boost performance of the page for showing data, implementing pagination. What procedure should I follow to implement pagination? Please help. ...

How can I learn ASP.NET?

I am an absolute beginner at ASP.NET. How can I learn it better? Currently I am reading ebooks. Can you suggest better ways, or other ways, I can learn ASP.NET? ...

System Out Of Memory Exception in Production Server

...

Keep track of number of events per timespan

What's the best way, in C# to keep track of the number of events per timespan? For example, I want to limit my TCP application to, say, a maximum of 10 requests per minute before setting a flag. The TCP application is intended to be as efficient as possible and runs as a windows service. Maybe I should work on it tomorrow when my brain...

Want to use image in datagrid to show active and inactive user?

i have a database of country table. sql 2005 like, country_id country_name region area population gdp status 84 indi asia 3432 3423 343 Active 85 U.k Europe 43432 3243 2343 Inactive I want to user image of active and inactive in...

ASP.Net HttpContext Cache-- why do I read Null when someone else says ""?

I have a coworker who's written the following line in the page load method in an aspx page: myDataSet = (DataSet)HttpContext.Current.Cache["dataset"]; The first time I hit the page HttpContext.Current.Cache["dataset"] reads null. When he does it, the value is "" (string.Empty) and he gets a cast exception. We're both running ASP.Net...

How can I set information on a cell in a datagrid based on its header or column?

I have an ASP.NET 2.0 DataGrid, like so: <asp:DataGrid runat="server" ID="_customerTable" CssClass="gridDisplay" HeaderStyle-CssClass="headerRow" AutoGenerateColumns="False" > <Columns> <asp:TemplateColumn HeaderText="First Name"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "FirstName") %> </ItemTemplate> ...

ASP.net Compile time XML/dataset checks

I would like an automated way to run compile time checks on datasets (or any xml) to make sure that expected values are found for certain properties. I have a fairly complex dataset in my asp.net Web Site. After modifying a query Visual Studio regenerates the tableadapter object and returns many properties to their default values. Thi...