|
How can I call method from one page to other page?
Thanks
|
|
|
|
|
Can you explain your question in more detail? This might make it easier to answer
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
yes sir,
I have one method in one page,There are 2 pages(_Default and _Default2)
in one webapplication .
one has already built method calcuatbalance()
Now i want to call from page2
this is page1 one.
<br />
<br />
Partial Class _Default<br />
Inherits System.Web.UI.Page<br />
<br />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br />
<br />
<br />
call calcuatbalance()<br />
<br />
<br />
<br />
End Sub<br />
<br />
<br />
public sub calcuatbalance()<br />
....<br />
....<br />
....<br />
End sub<br />
<br />
End Class<br />
<br />
this is page2
<br />
<br />
Partial Class _Default2<br />
Inherits System.Web.UI.Page<br />
<br />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br />
<br />
<br />
call calcuatbalance()<br />
<br />
End Sub<br />
<br />
How can I call calcualte balance from _Default2 page.
Thanks
|
|
|
|
|
Best thing to do would be to take the function out into it's own class and put it inside the app_code folder and use it from both the pages.
HTH
|
|
|
|
|
I have an application that "serves" barcode images to client pages. It is called by referencing the server page in the "src" or "ImageURL" property of an img object, along with parameters, such as <img src="barcode.aspx?code=ABCDEF123&width=3&height=0.75&barcolor=Red" alt="" />
It's working well, but now I'm trying to handle any errors that might occur. I would like to place the error description on an image that I download to the client page in place of the barcode image that *would* have been displayed if there had been no errors. I'm getting totally confused by all the graphics options. All I know is that I start with my message text ("rs_Message"), somewhere in the middle there'll be a "Dim Image As Byte()" line, and I need to end with the lines:
Response.Clear()
Response.ContentType = "image/gif"
Response.BinaryWrite(Image)
Response.End()
Any thoughts?
|
|
|
|
|
hi
i have assign file name in fileupload control text area while i am editing gridview
i give a code like this but it display error
fileupload_ads.FileName=gv_chadvert.Rows[e.NewEditIndex].Cells[4].Text;
please help me
with regards,
bretto
|
|
|
|
|
You can't assign anything to the FileName property of the upload control. That would be a serious security hole, as you could access the contents of files on the client system by automatically uploading them.
The user has to select the file to upload.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I have a nested gridview using javascript to show and hide a child grid, I would also like to show or hide ALL child grids by clicking a checkbox. The javascript I am using is pretty popular, as you can see I have it set to have all children open, I populate the plus and minus button from the RowDataBound event because not all my parents have children. My javascript knowledge is very bad, what I need help with is:
How to make the ShowAll function, the HideAll function, and the call to it from the checkbox, also, how to sent the count to the functions because not all my parents have children. Thanks in advance for any help.
--Javascript--
<script language="javascript" type="text/javascript">
function expandcollapse(obj,row)
{
var div = document.getElementById(obj);
var img = document.getElementById('img' + obj);
if (div.style.display == "block")
{
div.style.display = "none";
if (row == 'alt')
{
img.src = "../../images/plus.gif";
}
else
{
img.src = "../../images/plus.gif";
}
img.alt = "Expand Child Tasks";
}
else
{
div.style.display = "block";
if (row == 'alt')
{
img.src = "../../images/minus.gif";
}
else
{
img.src = "../../images/minus.gif";
}
img.alt = "Close Child Tasks";
}
}
function ShowAll()
{
}
function HideAll()
{
}
</script>
--RowDataBound--
if (e.Row.RowType == DataControlRowType.DataRow)
{
GridViewRow row = e.Row;
int taskID = (int)DataBinder.Eval(e.Row.DataItem,"TaskId");
if(taskmanagement.GetChildrenTasksCount(taskID) > 0)
{
showChildButton.Attributes.Add("style", "display:block;");
GridView gv = new GridView();
gv = (GridView)row.FindControl("grvChildGrid");
ClientScript.RegisterStartupScript(GetType(), "Expand", "<SCRIPT LANGUAGE='javascript'>expandcollapse('div" + taskID + "','one');</script>");
gv.DataSource = taskmanagement.GetChildrenTasks(taskID);
gv.DataBind();
|
|
|
|
|
hi
i am binding values from database to ddl through sqldatareader
records are binding in my dripdownlist but my first record is dosen't bind
i.e if i have 4 records in my table. ddl is binding only three records from 2 to 4 only dosen't bind 1st record.
shall i know what is the problem
please help me...
with regards,
bretto
|
|
|
|
|
Please could you paste your code.
Are you sure are reading all the records.
How are you binding the data?
|
|
|
|
|
objDDL.fillDDL(ddlState, "codstate", "", False, Constants._DDL_Default_Select)
objDDL.fillDDL(ddlDistrict, "CODDistrict", "", False, Constants._DDL_Default_Select)
objDDL.fillDDL(ddlCity, "CODcity", "", False, Constants._DDL_Default_Select)
using ddlstate,district,city tables
|
|
|
|
|
First thing is Debug the application
And see what you are getting from database.
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
dont call sqlReader.Read()
just set the datasource for the dropdown, the DataTextField, and the DataValueField, to whatever column you want them to be(the text field is what is displayed) and call the DataBind function on the drop down.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
the person above has given the exact answer....this is what msdn has to say about the Reader.Read()----Advances the reader to the next block of data in cases where the reader contains more than one block.So the first call gets u past the first record i believe.
|
|
|
|
|
Hi
I am trying to use the ajax timer control.
I have got it working in my app so the time is running at real time i.e. updating every second.
The problme is the rest of my app is grinding to a halt because of the timer control.
The timer control sits in the master page but every other page takes a lot longer to load than before
Any ideas?
thanks
|
|
|
|
|
Also my controls that have autopostback now dont work
|
|
|
|
|
Might be your timer control is taking more CPU time than other process.
Its total gyess not sure
[Edited]
You should always remember that even though partial updates are not as heavy on the server as real postbacks, the server is still contacted, and when using timers, you may get a lot of partial postbacks, which can slow things down. Always use as high intervals as possible, and consider if contacting the server is really necessary or not.
Taken from
http://ajax.net-tutorials.com/controls/timer-control/[^]
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
Does the ajax control run the page load code when it refreshes even a small part of the page?
|
|
|
|
|
|
So putting a timer control on a page which has controls which autopostback is not a good idea yeah?
How annoying, I will have to scrap the timer control.
Be good if you could re-load the page without the whole code running
|
|
|
|
|
|
Hi in my image click i am hiding one TD column in my table and assigning another image url to my image...,
Everything working fine...,
But After hide if i click the changed image it have to show the TD column...,Its not working fine....,
How to do that...,
This is my code for hiding the TD column:
function centerimgclick()
{
var ch=document.getElementById('CenterImg');
if(ch.src="Images/LeftHide.jpg")
{
document.getElementById('LeftTD').style.display='none';
document.getElementById("RightTD").style.width='100%';
document.getElementById('CenterImg').src="Images/LeftExpand.jpg";
return;
}
else if(ch.src="Images/LeftExpand.jpg")
{
document.getElementById('LeftTD').style.display='block';
document.getElementById("RightTD").style.width='80%';
document.getElementById('CenterImg').src="Images/LeftHide.jpg";
return;
}
}
and calling this script in my image click like this:
<img id="CenterImg" src="Images/LeftHide.jpg" onclick="javascript:centerimgclick();"/>
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
Instead of document.getElementById('LeftTD').style.display='block';
Have you tried:
document.getElementById('LeftTD').style.display='table-cell';
Hope this helps,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
hi all,
I used this site a reference for many thing . I got answers from other,s post itself .Rarely i posted questions
Now i am facing a problem . I were using module variables in application .Now we chnaging to session varibles
I am using an object of a class in each webpage . since i dont want to declare that object in each function i am declaring at the form level
when i was using module variable it was not giving any error
i changed it to session variable . Now it s giving an error
error is pasted below
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.
so i added EnableSessionState="True" to page directive . then also it is giving error
this is the code that gave the error
Partial Public Class Chart
Inherits System.Web.UI.Page
Dim ObjCls As New MVCTM.ClsFetchApply("", Session("country"))
Dim OraMod As New MVCTM.ModMain(Session("country")) Dim dt As New DataTable()
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
when i changed the declaration in to form load it is not giving any error
Partial Public Class Chart
Inherits System.Web.UI.Page
Dim dt As New DataTable()
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ObjCls As New MVCTM.ClsFetchApply("", Session("country"))
Dim OraMod As New MVCTM.ModMain(Session("country"))
Can any one suggest me a solution
thanks & regards
nevviin
|
|
|
|
|
Hi...
You can't get the Reference of session before pageload... that means in Pageinit
|
|
|
|