|
I think i am getting an exception but the code i wont to write into the event log isnt working.
Its a permission thing, i've created an event source in the registry but it still isnt writing too it. Im going to try to track down the users ASP is running under on my server and then all that user write permissions.
Thanks for the help, its always nice to go back to basics
|
|
|
|
|
Why on earth does every form I create run the Form_Load event when I click a button on the form? Is there something I am missing in the switch from Windows Forms to Web Forms? I feel like a right n00b on this but it is driving me mad to find that everytime it clears the form before trying to run the code.
A bit of further explanation...
I have a web-form application that dynamically sets itself up depending on who is looking at it. If an item in a list is selected and then a button clicked that should take you to another form, instead we are taken back through the form setup, which of course reloads the data back into the lists and therefore removes the selectedItem references.
So if anyone can help me stop my app doing this inane activity I will be grateful.
|
|
|
|
|
You need to understand that the way Windows executes program is completely different from the way you will see in your Web(ASP.Net) application.
The first thing one should write on the wall before starting any web application is that Web is stateless[^](or Google for a better answer).
Here [^]is a very good explanation regarding the order of events in ASP.Net page life.
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.
|
|
|
|
|
By the sounds of it you need to check the isPostBack property of the Page object. This is used to tell if its the first time the page is loaded or its a postback.
If its the first time you would want to do things like your dynamic setup of the form i.e. fill in items in a dropdown box or create dynamic controls but you wouldnt want to do this everytime the page loads, otherwise you end up added the same information twice to the page.
Look at the Asp.net Page Life Cycle from that you will find that the page load event will run when before the onclick event of the button.
See here http://msdn.microsoft.com/en-us/library/ms178472.aspx[^]
If you want the button to redirect to another page then you can use
Response.redirect("Somepage.aspx")
or
Server.Transfer("Somepage.asx")
Each has its own merits i would depend on what you are trying to achive.
Hope that helps
Phil
|
|
|
|
|
hi all i try to make slid show and i use it in a usercontrol
it works well but i want to get the image array from cs file
here is the code
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="JavaHomePhotoAlbum.ascx.cs" Inherits="taboukproject.UserControls.JavaHomePhotoAlbum" %>
<script type="text/javascript" src="../Scripts/dropinslideshow2.js">
</script>
<div style="width: 205px; height: 180px;" align="right">
<script type="text/javascript">
//Define Image Array. Syntax: ["image_path", "url_destination", "url_target"]
var myimages=new Array();
myimages[0]=["../Images/TabukImages/castle1.jpg", "", ""]
myimages[1]=["../Images/TabukImages/castle2.jpg", "http://www.dynamicdrive.com", ""]
myimages[2]=["../Images/TabukImages/castle4.jpg", "http://www.javascriptkit.com", "_new"]
//Create new drop-in slideshow
//Syntax: new dropinslideshow(image_array, slideshow_width, slideshow_height, delay_before_rotation)
new dropinslideshow(myimages, 200, 160, 3000)
</script>
</div>
please i want to know how can i atchive it
i try this code but not working
var myimages=new Array(<%ImagesArray(); %>);
the method ImageArray returns arraylist but i can't see it inside the script
even i set the method to public
MD_NADA
|
|
|
|
|
You need to user ScriptManager.RegisterArrayDeclaration
Have a look here[^]
only two letters away from being an asset
|
|
|
|
|
Hello friends,
I waana a promotion message box when i click on close button which is at the top of the browser.How can i do it? It may be a javascript code.
Thanks in advance.
Cheers,
MAHESH
|
|
|
|
|
Use onclose event and use window.alert for the message.
Books are as useful to a stupid person as a mirror is useful to a blind person. - Chanakya
|
|
|
|
|
Greetings,
I have loaded checkboxes in asp table control at form load evevt; from database.
Now I want to get all checked values in 1 array.
I used for each loop & stored control in 1 checkbox object & if that is checked then add value in array.
my code is as follows
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
fillControls()
End If
End Sub
in fillControls(), I took datatable for Id & name. & added checkboxes as
Dim objTr As New TableRow
For intCnt = 0 To objDataTable.Rows.Count - 1
If intCnt Mod 4 = 0 Then
objTr = New TableRow
table1.Rows.Add(objTr)
End If
Dim objTd As New TableCell
Dim objChk As New CheckBox
objTr.Cells.Add(objTd)
objTd.Controls.Add(objChk)
objChk.Attributes.Add("runat", "server")
objChk.ID = objDataTable.Rows(intCnt).Item(0)
objChk.Text =objDataTable.Rows(intCnt).Item(1)
Next
And when user submit the form< I want to get all id's of checkboxes in 1 array
for that I wrote,
Dim arrSubMnu() As Integer = New Integer() {}
For Each ctl As Control In table1.Controls
If TypeOf ctl Is CheckBox Then
If CType(ctl, CheckBox).Checked = True Then
ReDim Preserve arrIds(arrIds.Length)
arrIds(arrIds.Length) = ctl.ID
End If
End If
Next ctl
I couldn't find out where is error.I am not getting anything in array
Please Help Me to solve this problem
|
|
|
|
|
What is the definition for table1 variable? Is it public? as from the code it looks like it could be used as a local variable.
You could set a break point on the line starting "For Each ctl As Control In table1.Controls" and see if it says that the table contains any controls
If it does then then next line to look at would be the runtime values of the "If CType(ctl, CheckBox).Checked = True Then" line does it say the value is checked? how does that corrospone to the database values?
Any chance you could post the code as a code block? the entire page and behind code?
Phil
|
|
|
|
|
Controls created at runtime will lost at the time of post back. One solution is to call fillControl function outside the If Not IsPostBack checking.
|
|
|
|
|
Finally I got answer
Just using Request object you can get all objects even runtime added
on submit button :
<pre>Dim arrSubMnu() As Integer = New Integer() {}
Dim strT As String
For Each strT In Request.Form
If strT.ToString.Contains("Chk_") And Request.Form(strT).ToString.ToUpper = "ON" Then
Dim strTemp As String = strT
ReDim Preserve arrSubMnu(arrSubMnu.Length)
arrSubMnu(arrSubMnu.Length - 1) = strTemp.Substring(strTemp.IndexOf("Chk_") + 4)
End If
Next</pre>
(here set 'Chk_' as prefix to checkbox id's to find control easily)
|
|
|
|
|
i have migrated the sql server 2005 databse to oracle 10g...
in that one table is having an identity column(auto increment column)
i have done tht using sequence and triggers...
now if i direcltly execute the StoredProcedure,the new row is inserting with the given values..with new RequestID(ie auto increment)
if am executing through code its giving error:
PLS-00306: wrong number or types of arguments in call to 'EDOCSNET_INSEDOCREQHEADER' ORA-06550: line 1, column 7: PL/SQL: Statement ignored .
can anybody tel me how to pass the identity value for the column reguestID?
thanks in advance..
|
|
|
|
|
Don't post same question twice.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
ok..net was down so by mistake it happened.
|
|
|
|
|
Duplicate Question.Please ignore
|
|
|
|
|
Please don' t cross post.
|
|
|
|
|
Hi,
How to add arl_CoList2 to disabled & checked checkboxes and checked the rest of company id from Table1?
Updating company list:
When page loads it will get from tbCompany with checked checkboxes of company id from Table1.
I want to disabled and checked the checkbox (when company id from Table1 exist in Table2 & Table3)
other checkboxes company id can be added if checked. Only enabled checkbox can be unchecked and deleted.
GridView do not have datakeyname.
<br />
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) <br />
{ <br />
if (e.Row.RowType == DataControlRowType.DataRow) <br />
{ <br />
ds = new DataSet(); <br />
dv = new DataView(); <br />
arl_CoList2 = new ArrayList(); <br />
<br />
ds = otmcl.GetCompany(Session["Dept"].ToString()); <br />
<br />
if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate) <br />
{ <br />
dv = ds.Tables["Company"].DefaultView; <br />
<br />
lbl_CompanyID = (Label)e.Row.FindControl("lblCompanyID");
cb_selectCo = (CheckBox)e.Row.FindControl("CheckThisCompany"); <br />
<br />
ddl.DataSource = dv; <br />
ddl.DataTextField = dv.Table.Columns["CompanyName"].ToString(); <br />
ddl.DataValueField = dv.Table.Columns["CompanyID"].ToString(); <br />
ddl.DataBind(); <br />
<br />
int check = ddl.Items.Count; <br />
<br />
if (check != 0) <br />
{ <br />
GetCheckItems(); <br />
<br />
if (arl_CoList2 != null) <br />
{ <br />
arl_CoList2.Add(hid_id2.Value.ToString()); <br />
<br />
cb_selectCo.Checked = true; <br />
cb_selectCo.Enabled = false; <br />
} <br />
else if (!arl_CoList2.Contains(ddl)) <br />
{ <br />
cb_selectCo.Checked = true; <br />
cb_selectCo.Enabled = true; <br />
} <br />
<br />
} <br />
} <br />
} <br />
<br />
|
|
|
|
|
Hi,
How to Filter/Search context in Office(Word,Excel,pdf documents)
using Indexing Services.
ali
|
|
|
|
|
I know Office documents implements IFilter[^] interface. You can use that to extract text for the indexing service.
Books are as useful to a stupid person as a mirror is useful to a blind person. - Chanakya
|
|
|
|
|
iam having neary 3 webparts in the webpartzone and iam creating two webparts dynamically..now how can i apply themes to this webparts
|
|
|
|
|
I think you must be using some controls in your webpart and that must be in also skin file.If yes, then I dont there is any issue in applying the theme in the new webparts.
If there is another issue please let me know
|
|
|
|
|
|
Hi,
I need to send an email which has an attachment; the attachment is stored in sql server-2005, ina table as an image data type.
Thanks
shank
|
|
|
|
|
Download attachments from database and save in localdrive,then attach it in sending email.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|