|
In my page While the landingpage was load, the videos are displayed. Then i move to another page name video.aspx and upload one new video.when i move to the landing page That currently inserted video is not reflected in the landing page. I think because of cache problem.Any solution?
|
|
|
|
|
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
anushh wrote: That currently inserted video is not reflected in the landing page. I think because of cache problem.
Yes it is because of caching.
Browsers cache content depending on the URL. So when video is uploaded, change the URL of the video so that browser will load the latest content. To do this, add a dummy time stamp to the video link. Something like video.aspx?videoid=10×tamp=somerandomvalue
since the random value will be different each time, browser will be forced to load a latest version for each request.
|
|
|
|
|
You mean server cache or client cache ??
|
|
|
|
|
|
Remove Output Cache for One Page
HttpResponse.RemoveOutputCacheItem("/foldername/CacheForever.aspx");
Add Key Dependency to Page
Response.AddCacheItemDependency("clearcachekey");
Means we placed a dependance on smallkey. Now place this in global.aspx
protected void Application_Start(Object sender, EventArgs e)
{
HttpContext.Current.Cache.Insert("clearcachekey", DateTime.Now, null,
System.DateTime.MaxValue, System.TimeSpan.Zero,
System.Web.Caching.CacheItemPriority.NotRemovable,
null);
}
or add this in pageload on which you want to remove cache :
HttpContext.Current.Cache.Insert("clearcachekey", DateTime.Now, null,
System.DateTime.MaxValue, System.TimeSpan.Zero,
System.Web.Caching.CacheItemPriority.NotRemovable,
null);
|
|
|
|
|
plz tell me javascript validation for a textbox for blank and only characters and for only numbers.
and tell me how we use this function in textbox event.
thanks
|
|
|
|
|
hey go to Google
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Well, if you want to hire someone to do your job for you, the job board is just over there. On the other hand, if you intend on being a programmer yourself, you should look up regular expression validators in that book that you surely bought to help you learn ASP.NET.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
use
onblur="javascript: return reqcheck()" id="txt"
function reqcheck()
{
var txt = document.getElementById('txt');
if(txt.value.length == 0) return false;
return true;
}
|
|
|
|
|
Um, this will return true or false for one of the cases he mentioned, but how will it perform validation ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I dont know why those people dont use RequiredFieldValidators or RegularExpressionValidators for this.... I think those checks both in server as well as client..
Anyway, he can trap others in
form onsubmit="javascript: return validatefunction();"
I guess. I thought he can do the others himself.
|
|
|
|
|
Abhishek Sur wrote: I thought he can do the others himself.
*grin* if he were capable of that, he'd be capable of working out what a regularexpressionvalidator was.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Yes you are right.
|
|
|
|
|
|
Hellon every one.I have a table as follow;
Node_Id Node_Name Parent_Id
1 Classified 0
2 Job 1
3 Matrimony 1
4 Property 1
5 ChildofJob1 2
6 Childofjob2 2
i am using following code,but its not giving me proper structure.
My logic is,i add the node in to treeview at the same time i also check is this node present into Arraylist or not,if yes then i don't add that node if no then add the node to treeview as well as arraylist also.This procedure used for each and every node of tree.
// For database operation
OdbcConnection con = CodeClass.GetConnetion();
OdbcDataAdapter adapter1 = new OdbcDataAdapter("select * from AdminAddNewItem ", con);
OdbcDataAdapter adapter2 = new OdbcDataAdapter("select * from AdminAddNewItem ", con);
DataSet ds = new DataSet();
adapter1.Fill(ds, "Parent");
adapter2.Fill(ds, "Child");
ds.Relations.Add("relation", ds.Tables["Parent"].Columns["Node_Id"], ds.Tables["Child"].Columns["Parent_Id"]);
// ========================================================================================
//I am takeing a arraylist in which i am going to maintan all nodes
ArrayList list = new ArrayList();
string listitem;
int flage1 = 0;
int flage2 = 0;
//=============================
foreach (DataRow Prow in ds.Tables["Parent"].Rows)
{
// code for add parent nodes
TreeNode pnode = new TreeNode(Prow["Node_Name"].ToString(), Prow["Parent_Id"].ToString());
//code for chech whather the node already present or not
for (int i = 0; i < list.Count; i++)
{
if (pnode.Text.ToString() == list[i].ToString ())
{
flage1++;
break;
}
}
if (flage1 > 0)
{
flage1 = 0;
Response.Write("Node already exist");
}
else
{
TreeView1.Nodes.Add(pnode);
list.Add(pnode.Text.ToString());
}
//code for add Child nodes
// if (Prow.GetChildRows("relation") != null)
{
foreach (DataRow Crow in Prow.GetChildRows("relation"))
{
TreeNode Childnode = new TreeNode(Crow["Node_Name"].ToString());
pnode.ChildNodes.Add(Childnode);
list.Add(Childnode.Text .ToString ());
}
}
}
|
|
|
|
|
Please post your code with proper format.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
If your code works at all, it defines two levels, not three. I would imagine you can't do this in a way where you just bind to a datasource, or expect a table to work out the details for you. Your code is hideously inefficient on many fronts. It looks to me like it will add every node at the top level, also.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
A tree is a basic data structure and everyone should know to work with that.
When you add a node, you need to find the parent of that node using the parent id. To do this, keep a reference to the root node and iterate recursively until you find the node with the parent id. New node should be added as a child of this node.
Above method has a O(n) complexity where n is the total number of nodes in a tree. An efficient approach will be to keep each node in an associative container with node id as key. When adding each item, look for a TreeNode object in this container. Here is a working code.
void PopulateTreeView(DataTable dt, TreeView tv)
{
Dictionary<int, TreeNode> nodes = new Dictionary<int, TreeNode>();
TreeNode root = null;
foreach (DataRow row in dt.Rows)
{
int parentId = int.Parse(row["Parent_Id"].ToString());
int nodeId = int.Parse(row["Node_Id"].ToString());
string nodeName = row["Node_Name"].ToString();
TreeNode node;
if (nodes.TryGetValue(parentId, out node))
{
TreeNode newNode = new TreeNode(nodeName);
nodes.Add(nodeId, newNode);
node.ChildNodes.Add(newNode);
}
else
{
node = new TreeNode(nodeName);
nodes.Add(nodeId, node);
node.ChildNodes.Add(node);
if (parentId == 0)
root = node;
}
}
tv.Nodes.Add(root);
}
|
|
|
|
|
Good answer bro ..
|
|
|
|
|
|
Hello everyone,
I'm working on a web form and I'm dynamically creating a table on the page with two columns. One column has the text description, and the second has a check box which the user can check or uncheck to indicate that they want that particular item to activated. Because each user will have a different amount of options, I felt it best to build the table rows on the fly after I discover who the user is. The only problem I am fighting with now is that after I build the page and do any post back, the dynamic control is no longer there. Has anyone out there ever tried anything similar? I'm thinking I need to modify the post back somehow to indicate that I want the control to submit the check boxes back to the server so I can process them.
Thanks!
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.
|
|
|
|
|
You need to create the control on every postback. And you need to do it before pageload if you want any sort of viewstate to be restored.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi Christian,
Thanks for the input. Kudos on your blog too!
So, I need to use the Page.PreLoad event and build my control there? Right now I'm building the table using data from my database, so if I did that during the page preload, wouldn't that overwrite the post back arguments? Or do I have that backwards? If I create the table during the preload, will the changes in the post back overwrite the results from the database? Sorry if it sounds like a 'you should already know this' type question. I've been reviewing the articles I've found online about the page lifecycle, but it still seems a little vauge to me.
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.
|
|
|
|
|
compninja25 wrote: So, I need to use the Page.PreLoad event and build my control there?
Init will be a good place for dynamic controls.
It looks like you are displaying tabular data. Why don't you try controls like GridView or DataGrid ? GridView has inbuilt checkbox support. In DataGrid , a checkbox can be added by using a template column. If you can do that, you don't need to worry about the viewstate issues.
|
|
|
|