|
kiranreddy wrote: every thing remains the same which should not happen
You are seeing browser cached version of the page. This can't be stopped effectively.
|
|
|
|
|
You can Clear the session or abondon the session as
Session.Abandon();
or
Session.Clear();
for back button,
You have two option
a: disable the back button
b: clear the hostory
both can be done using javascript
Cheers!!
Brij
|
|
|
|
|
Brij wrote: You have two option
a: disable the back button
b: clear the hostory
option a to my knowledge it cant be done , Please provide the code for it
option b. Yes , Playing with windows history can restrict user from going back
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
Brij wrote: You can Clear the session or abondon the session as
Session.Abandon();
or
Session.Clear();
for back button,
No. No events are fired when back button is pressed.
Brij wrote: disable the back button
No reliable methods are available.
Brij wrote: clear the hostory
Not possible.
|
|
|
|
|
Dear
Does anyone know function that can get total days of month?
Socheat
|
|
|
|
|
Use below code
This will give the no.of days for Sep 2008
int noofdays =System.DateTime.DaysInMonth(2008, 10);
Cheers!!
Brij
|
|
|
|
|
Thank for your reply
Socheat
|
|
|
|
|
I have a checkbox that is with in a datalist which is in turn inside a panel.
I am trying to see if a checkbox was checked, to do some action.
how can I find the checkbox?
I get System.NullReferenceException: Object reference not set to an instance of an object.
Thank you.
the aspx.cs code
protected void testb_CheckedChanged(object sender, EventArgs e)
{
CheckBox chkBox = (CheckBox)Page.FindControl("chkMarkerInbox");
if (chkBox.Checked == true)
.....
//also tried this
CheckBox chkBox = (CheckBox) pnlInbox.FindControl("chkMarkerInbox");
if (chkBox.Checked == true)
....
}
Here is the sample code:
<asp:Panel id="pnlInbox" runat="server">
<asp:DataList DataKeyField="inboxID" ID="inboxDL" runat="server" OnItemCommand="DeleteInboxMessage_Click" DataSourceID="inboxDS" CellPadding="0">
<ItemTemplate>
<table border="1">
<tr>
<td>
<asp:CheckBox ID="chkMarkerInbox" runat="server" AutoPostBack="true" OnCheckedChanged="testb_CheckedChanged" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</asp:Panel>
|
|
|
|
|
First, you need the index of the item you need to get
CheckBox chkBox = (CheckBox) this.inboxDL.items[indexOfTheItemYouWant].findcontrol("chkMarkerInbox")
If you are getting the selectedindexchanged then:
CheckBox chkBox = (CheckBox) this.inboxDL.selectedItem.findcontrol("chkMarkerInbox")
Alexei Rodriguez
|
|
|
|
|
Thanks a lot. How come with the Items it finds it and without just like:
CheckBox chkBox = (CheckBox)this.inboxDL.FindControl("chkMarkerInbox");
It doesn't.
Since it's a data list I have a several row of checkboxes
CheckBox chkBox = (CheckBox)this.inboxDL.Items[1].FindControl("chkMarkerInbox");
When I put Items[1] it only changes state when I check that item.
How do I do it when any checkbox is marked?
Thank you again.
|
|
|
|
|
Albert83 wrote: How come with the Items it finds it and without just like:
CheckBox chkBox = (CheckBox)this.inboxDL.FindControl("chkMarkerInbox");
It doesn't.
Because datalist has many items and wouldnt know which one you want
Albert83 wrote: When I put Items[1] it only changes state when I check that item.
How do I do it when any checkbox is marked?
Loop through all items in datalist with with a for loop datalist.items.count - 1 or for each loop
Alexei Rodriguez
|
|
|
|
|
Thanks a lot. With the index it goes through the checkboxes that I have and not through the datalist items.
For example using your suggestion: this.inboxDL.Items[1]
CheckBox chkBox = (CheckBox)this.inboxDL.Items[1].FindControl("chkMarkerInbox");
Response.Write("check");
if (chkBox.Checked == true)
{
ddlTest.SelectedItem.Text = "works";
}
Only when I click on checkbox with index[1] ddlTest will change to "works".
But I have 5 more checkboxes which are not changing the state of ddlTest to "works".
So it goes through the checkboxes and not the datalist items as I understand.
Is it so?
But I made it work as follows. This way I assume when it encounter non checkbox controls it does nothing and when it does with Findcontrol it stores true/false in the isDeleted variable.
That's how I think the code works.
bool isDeleted = false;
foreach (DataListItem anItem in inboxDL.Items)
{
isDeleted =
((CheckBox)anItem.FindControl("chkMarkerInbox")).Checked;
if (isDeleted)
{
lbDel.Enabled = true;
ddlTest.SelectedItem.Text = "works";
}
}
Thanks again.
|
|
|
|
|
i am uploading images to server under this folder "UploadFiles" and saving uploaded file properties in database, details like (FileID, FileName, Path).
now i can bind data to datalist and show these details.
what i like to do is show a thumbnail of image in datalist. and when the user clicks that thumbnail show the actual image in a new page.
here is my code begind.
<br />
Private Sub GetAllTheFiles()<br />
<br />
' Declare objects...<br />
Dim objConnection As SqlConnection = New _<br />
SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Files;Data Source=my\SQLEXPRESS")<br />
<br />
objConnection.Open()<br />
<br />
Dim myCommand As New System.Data.SqlClient.SqlCommand()<br />
myCommand.Connection = objConnection<br />
<br />
myCommand.CommandText = "GetAllTheFiles"<br />
myCommand.CommandType = CommandType.StoredProcedure<br />
<br />
Dim param As New System.Data.SqlClient.SqlParameter()<br />
<br />
Dim myAdapter As New SqlDataAdapter(myCommand)<br />
<br />
myAdapter.Fill(AllTheFilesFromDB)<br />
<br />
Dim reader As SqlDataReader = myCommand.ExecuteReader()<br />
<br />
d1.DataSource = AllTheFilesFromDB<br />
<br />
d1.DataBind()<br />
' Close the connection...<br />
objConnection.Close()<br />
<br />
End Sub<br />
i am calling above sub in page load.
and here is my datalist
<br />
<asp:datalist id="D1" runat="server" xmlns:asp="#unknown"><br />
<itemtemplate><br />
<table border="1"><br />
<tr><td>File ID : </td><br />
<td>'<%#DataBinder.Eval(Container.DataItem, "FileID")%>'<br />
</td></tr><br />
<tr><td>File Name : </td><br />
<td>'<%#DataBinder.Eval(Container.DataItem, "FileName")%>'<br />
</td></tr><br />
<tr><td>Path : </td><br />
<td>'<%#DataBinder.Eval(Container.DataItem, "Path")%>'<br />
</td></tr><br />
</table><br />
</itemtemplate><br />
</asp:datalist><br />
|
|
|
|
|
To show an image, just add an image control and set
imageurl = '<%# DataBinder.Eval(Container.DataItem, "FileName", "~/UploadFiles/{0}") %>'
Then to add the link to the image in a separate page, you can insert the imagecontrol inside a hyperlink control with
navigateurl = '<%# DataBinder.Eval(Container.DataItem, "FileName", "~/UploadFiles/{0}") %>'
Youll be showing the same image in both places, if you really want to show first a small image, you either need to creat it when you upload it or implement a handler to create thumbnails on the fly when they are requested
Alexei Rodriguez
|
|
|
|
|
Hi,
Yesterday I created a class file and placed under APP_Code directory and today I placed four more class files under the same directory. When I place an ObjectDatasource control onto form, I am able the see the old one (the one yesterday I created) but not the new ones.
I decided to create a new class file and copied all the codes from old class file and saved it in a different name. It didn't show up too when I tried to browse the business objects. I did so to see if any wrong coding was causing the issue. I decided to move new class files out of App_code directory and then tried to re-browse the business objects, it didn't work out too. Also I realized that ObjectDataSource is not only looking for the business objects under APP_Code directory but under all the directories.
I use VS 2008. I would like to know the reason of the problem. Would it be a cache related problem?
Thanks.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Hay ...
the next error message
Both DataSource and DataSourceID are defined on 'GridView'. Remove one definition
in spite of the page was ok ,
I tried to solve it without any result
jooooo
|
|
|
|
|
You may be assigning to the DataSource property in your code behind file.
|
|
|
|
|
thanks my friend ... now it's ok
jooooo
|
|
|
|
|
I'm using Sitefinity (www.sitefinity.com) and trying to get two custom built controls to talk to each other. I'm looking for suggestions as to how I could accomplish this. I'm using .Net 3.5. Right now I can pass data one way using the Page.Context.Items collection and viewing that from the OnPreRender().
One control is a breadcrumb generator and the other is a browse control. The two should work in tandem. When the breadcrumb trail is clicked the navigation should update with that level's sub-items. And if a sub-item is clicked in the navigation control the breadcrumb should update accordingly (standard breadcrumb + navigation setup going against a heirarchical table)
These controls are added to the page from the sitefinity interface, so I don't know what the ID or ClientID of these controls will be as it is controlled by the sitefinity CMS software. I do have access to the Page object inside each control. I would love to use Events to communicate between the two, I'm just not sure how to make that happen or where in the page / control lifecycle to do it.
Any suggestions?
|
|
|
|
|
Hi!
I made a test on the issue. Check my code snippets:
EventInterface:
public delegate void ControlChangedDelegate(ControlChangedEventArgs e);
public class ControlChangedEventArgs : EventArgs
{
private object controlInfo;
public object ControlInfo
{
get { return controlInfo; }
set { controlInfo = value; }
}
public ControlChangedEventArgs(object info)
{
controlInfo = info;
}
}
public interface EventInterface
{
event ControlChangedDelegate ControlChanged;
void Updatecontrol(object info);
}
The page:
public partial class _Default : System.Web.UI.Page, EventInterface
{
protected void Page_Load(object sender, EventArgs e)
{
}
#region EventInterface Members
public event ControlChangedDelegate ControlChanged;
public void Updatecontrol(object info)
{
ControlChanged(new ControlChangedEventArgs(info));
}
#endregion
}
Control 1:
public partial class WebUserControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
((EventInterface)this.Parent.Page).ControlChanged += new ControlChangedDelegate(WebUserControl_ControlChanged);
}
void WebUserControl_ControlChanged(ControlChangedEventArgs e)
{
string s = e.ControlInfo.ToString();
}
}
Control 2:
public partial class WebUserControl2 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
string controlInfo = this.ID;
((EventInterface)this.Parent.Page).ControlChanged += new ControlChangedDelegate(WebUserControl_ControlChanged);
((EventInterface)this.Parent.Page).Updatecontrol(controlInfo);
}
void WebUserControl_ControlChanged(ControlChangedEventArgs e)
{
string s = e.ControlInfo.ToString();
}
}
i have not made any extensive test on this but i think it will work.
|
|
|
|
|
I have a user type in some information, it calls and API and returns an XML document. I then show some more entry fields that are based on what they entered on the first API submission. I then need to take what they typed in after the first submission, use that to edit the created XML and then submit to another API.
What is the best way to save XML between post backs? session varialbe, save a string in a database and do a load, something like _serviceXML.LoadXml(Session("addServiceXML").ToString)? If I was working in windows forms I would use a get/set to do this.
Thanks.
andy
|
|
|
|
|
It depends on the amount of xml. If it isn't too big then use session. BTW, it is a good practice to create a class of of session items with properties (get / set) for each item. That way when you access the item in your application you can't cause an error by making a typing mistake.
Also, you can store a [serializable] object in Session. It doesn't have to be a string.
I didn't get any requirements for the signature
|
|
|
|
|
Hello Friend's
i want file copying from 1 source to multiple destination How it is possible please help me?
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Do the copy once to each destination?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks For reply
Absolutely Like this but copy at a time on all disk destination drive.
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|