|
Hello.
am trying to set a value from aspx.cs page (string str) and then want to access that value in the aspx page.
Please let me know how to do that.
|
|
|
|
|
Hi,
- Declare your variable as public in the aspx.cs
- in your .Aspx use : <%=myVar%> in any place
HTH
Hayder Marzouk
|
|
|
|
|
Hi all,
I use DetailsView Object in ASP.NET.
It dosen’t appear until the refresh button in IE clicks.
I set the DataSource Property and use the DataBind Method.
What i can do?
|
|
|
|
|
would you like to post your code with the event you are using to perform tis task?
|
|
|
|
|
Hi
This is my code
asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" Height="40px"Style="direction: rtl" Width="472px"
Fields
asp:BoundField DataField="Employer" HeaderText="کارفرما"
asp:BoundField DataField="Advisor" HeaderText="مشاور"
asp:BoundField DataField="StartTime" HeaderText="زمان شروع"
asp:BoundField DataField="EndTime" HeaderText="پیش بینی تاریخ اتمام پروژه"
asp:BoundField DataField="TimeAgreement" HeaderText="مدت قرارداد به ماه"
asp:BoundField DataField="State" HeaderText="محل اجرا"
Fields
asp:DetailsView>
asp:SqlDataSource ID="SQLDS_ALLV_TitleIE" runat="server" ConnectionString="<%$ ConnectionStrings:SamanMohitConnectionString %>"
SelectCommand="ALLV_TitleIE" SelectCommandType="StoredProcedure"
SelectParameters
asp:ControlParameter ControlID="Label1" Name="F_Title" PropertyName="Text" Type="String"
asp:Parameter DefaultValue="فارسی" Name="F_Language" Type="String"
SelectParameters
asp:SqlDataSource
I use the "<"and "/>" in my code
And this is runtime code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Application("SN") = "Agreement") Then
Label1.Text = PreviousPage.mText1.Text
DetailsView1.DataSource = SQLDS_ALLV_TitleIE
DetailsView1.DataBind()
ElseIf (Application("SN") = "News") Then
Label3.Text = PreviousPage.mText1.Text
DetailsView2.DataSource = SQLDS_NL_Title
DetailsView2.DataBind()
End If
LinkButton1.CommandName = Application("Search")
End Sub
-- modified at 0:48 Sunday 8th April, 2007
|
|
|
|
|
سلام
اگر فارسی می نویسیم به این دلیل است که از نوع عناوین جنابعالی فهمیدم که ایرانی هستید.
به هر حال برای Bind کردن DetailsView با این روشی که شما انتخاب کرده اید و از SqlDataSource استفاده می کنید، برای گرفتن نتیجه باید از DetailsView1.DataSourceId استفاده کنید درضمن هنگام تعریف DetailsView میتوانید در کد های HTML نیز این مشخصه را تعیین نمایید برای مثال:
asp:DetailsView ID="dtl1" DataSourceId="SQLDS_ALLV_TitleIE" runat="server" ..... /asp:DetailsView
در ضمن بهتر است دستور Select شما حاوی شرطی باشد که موجب برگرداندن یک رکورد شود.
اگر هم با SqlDataSource مشکل دارید می توانید از DataTable استفاده کنید.
البته با عرض معضرت باید بگویم که روشی که شما انتخاب کرده اید با مراجعات متعدد به سایت رفته رفته از سرعت آن کاسته خواهد شد یعنی خاصیت SqlDataSource چنین است که در هر بار PageLoad اجرا شود در حالی که شما فقط به یکی از SqlDataSource ها نیاز دارید ولی در هر بار هر دوی انها اجرا خواهد شد که این روش خوبی نیست.
به هر حال اگر به نتیجه نرسیدید اگر کمکی از دست من بربیاید یا در همین سایت و یا به آدرس abolfazl585@yahoo.com میل بزنید.
باتشکر
We Can Do Anything, If We Want It
|
|
|
|
|
Hi all,
I use Application object in ASP.NET.
I set it’s value in one page and read it in another page but I don’t know when I can dispose this object in order to in the first page it’s not set and if an event accord it set again.
Thanks in advance
|
|
|
|
|
You should only use the application object for things you want to keep across user sessions. Like some sort of static data that all users would be looking at. It sounds like you should be using a session variable to pass things from one page to the next. Session is very similar to the application object except it is only for that user, other users can see that object, they can only see their own session object.
Either way if you want to remove and object from the session or application you can just set it to null or Nothing in vb.net. There is also a Remove method in the object to remove something from the application or session object.
Hope that helps.
Ben
|
|
|
|
|
When i can use it?(What event)
|
|
|
|
|
You can use the session and application object anywhere in the codebehind. All events have access to it.
Ben
|
|
|
|
|
I use it in Finalize Method of the page but in order to access again to it i don't know What i can?
|
|
|
|
|
Perhaps it is better for you to explain what you are trying to do and then I might be able to suggest something for you to try. Finalize method of the page seems like a strange place to set a variable in session or application. Most of the time I set it in th page load event.
Ben
|
|
|
|
|
Hi
I have a dropdownlist where the user.the user will select the name of the project from.Please help me with the code for my problem.........
************
After the user selected the project Name on my listbox display the name of all the Project Members working under that particular project.
Please help me
oga m
|
|
|
|
|
Hey that is very simple.
What you have tried so for?
What is the Error you are getting?
Regards,
Satips.
|
|
|
|
|
first u`ll need to execute a select query where in u`ll select on the bases of the project selected from the drop down list such as
"Select * from project where projname = '+ddwlist.selectedvalue+'
then u`ll populate ur listbox like this
while(rd.read)
{
listbox1.items.add(rd["projmembers"].tostring)
}
i hope this solves ur problem
Kunal
|
|
|
|
|
Hi Guys
I'm actually very confused.Is it possible that I can use both CommandField and CheckBoxField in my GridView
oga m
|
|
|
|
|
yes, thas is very easy
<asp:CommandField ButtonType="Link" />
<asp:CheckBoxField DataField="yourFiled" />
.
.
.
if this code dont help you, please say me your question in good question
-- modified at 3:46 Monday 9th April, 2007
We Can Do Anything, If We Want It
|
|
|
|
|
I am using namespace system.io
in that i am taking file and deleting it.
File.Delete(filename);
it gives error access to this file is denied for few files rest files it is deteting.
can someone please help me out ??????
thanks in advance .
|
|
|
|
|
You have to grant WRITE permission for asp.net account, I think
<< >>
|
|
|
|
|
manage your asp.net account permissions
or config your web.config file
We Can Do Anything, If We Want It
|
|
|
|
|
can you please help me in doing so.
thanks
|
|
|
|
|
create new folder in your hard drive. c:\temp for example.
select it and right click over the folder and chose properties.
select the security tab and then press add button to adding new user.
select aspnet user and press ok.
in the permissions section allow fullcontrol access.
then your operations(delete,modify,create,...) must be referenced to this folder.
We Can Do Anything, If We Want It
|
|
|
|
|
when i click open or new project in asp.net,the error is display like
"Visual Studio.NET has detected that the specified Web server is not running
ASP.NET version 1.1. You will be unable to run ASP.NET Web applications or
services".
how to solve this problem?
|
|
|
|
|
I'm not sure...but here is just a suggestion
Open IIS MMC, check the ASP.NET version setting of your site
<< >>
|
|
|
|
|
goto windows\microsoft.net\framework directory and find .net Frameworke version that your application use it and from it's location find aspnet_regiis.exe and execute it such as "aspnet_regiis.exe /i"
We Can Do Anything, If We Want It
|
|
|
|