Avance Zone

Technical Experts Zone Blogs

Get Asp.net Dynamic ID In Client Side For JavaScript

Get Asp.net ID Dynamic Server Id in Client Side For JavaScript 

<script type=”text/javascript” language=”javascript”>

    function search()

    {

    if (document.getElementById(”<%=txt_search.ClientID %>“).value==”")

    {

        alert(”Please Enter Keyword”);

    }    

    }

</script>

<asp:ImageButton ID=”btn_search” OnClientClick=”return search()” runat=”server” ToolTip=”Search the website”/>

Here i Shown How i Fetched the Dynamic Image Button Id in the server side to implemnt the javascript Function.

Enjoy !!! Please Comment if you need a clear Understanding.

ASP.Net tablecell add image

Here are the steps to add a image dynamically to a table cell in asp.net

tc1 = New TableCell
‘tc1.Text = dr1.Item(6)
If (dr1.Item(6) = 2) Then
tc1.Text = “<img src=images/image1.bmp >”
End If
If (dr1.Item(6) = 1) Then
tc1.Text = “<img src=images/image2.bmp >”
End If
If (dr1.Item(6) = 0) Then
tc1.Text = “<img src=images/image3.bmp >”
End If

Here “tc1″ is the table cell i declared and dr1 is some array item.. Just insert it with any condition and play with your code.

Asp.Net Request rediect from current url

Use The below sring to get the current url and redirect from there with a query string

Request.Url.ToString will give the current url as sting
Response.Redirect(Request.Url.ToString + “&page=newpage”)

 

NT AUTHORITY\NETWORK SERVICE Error on .Net

The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to ‘F:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET

If You are getting the above error and want to solve Esily here is the way :

1.Give access to network and network serveices to windows and sub dirs
2. Type gpupdate /force in cmd promt

This solves the problem..

FAQ’s

Methods are fired during the page load ?
Init() – when the page is instantiated
Load() – when the page is loaded into server memory
PreRender() – the brief moment before the page is displayed to the user as HTML
Unload() – when page finishes loading.

When during the page processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.

Where do you store the information about the user’s locale?
System.Web.UI.Page.Culture

What’s a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

Suppose you want a certain ASP.NET function executed on MouseOver for a certain button.  Where do you add an event handler?
Add an OnMouseOver attribute to the button.  Example: btnSubmit.Attributes.Add(”onmouseover”,”someClientCodeHere();”);

What data types do the RangeValidator control support?
Integer, String, and Date.

Explain the differences between Server-side and Client-side code?
Server-side code executes on the server.  Client-side code executes in the client’s browser.

What is the Global.asax used for?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.
How many classes can a single .NET DLL contain?
It can contain many classes

|