|
Hi Sushant,
Thank you very much for help.
along with your code, i am adding this two lines. if i dont have today's date or future dates in my datagrid it will highlight the latest past date in datagrid.
else if(DateTime.Compare(DateTime.Today, dt) == +1)
e.Item.BackColor = Color.red;
But, this makes backcolor red for all past dates rows instead of just a single latest past date.(I have at present, no future dates or today's date)
I want to highlight only latest past date in datagrid.
Any help??? that's really urgent.
and, adition to that, it should pass the value for that row as default to the client side javascript function when page load (this should be same for future date, today's date or latest past date).i am trying with 'onload' function, but it's not working.
Presently i m passing values on 'onclick' event, as below:
e.Item.Attributes.Add("onclick","ShowDetail('"+
DataBinder.Eval(e.Item.DataItem,"TOPIC_DATE")+"');");
any thing you can suggest, it will be very much helpful for me.
Thanks you very much again.
NIKI
|
|
|
|
|
HI Niki,
if you want to do that, then you need to add all the rows information of the datagrid in an data table.
do one thing,
create a datatable(define the datatable globally) , take two columns , one for date and one for row index.
do this in ItemDatabound event.
then where you are binding the grid, after datagrid.DataBind(), compare and change the color.
I hope you got my idea , and this idea works
Thanks
Sushant Duggal.
|
|
|
|
|
Hi Sushant,
This should not work??
if(DateTime.Compare(DateTime.Today, dt) == +1)
{
e.Item.Attributes.Add("onload","this.style.backgroundColor='red';");
I don't know, i m not sure.
Thanks,
|
|
|
|
|
hi niki,
where r u checking that it is the latest one??????
This will color all the rows.
Sushant Duggal.
|
|
|
|
|
Hi Sushant,
I have all the past values at present.
so, i want to highlight only the latest past date row.
but instead, it's highlighting all past values.
I am checking in the item_databound property.
Thanks,
NIKI
|
|
|
|
|
HI Niki,
what I wrote in the last thread was to change backcolor of one row only.
I got a new and easy Idea.
DO one thing, on the page load event, get the max date from the database, then in ItemDataBound compare that date with all the rows, which ever matches, change the backcolor of that row.
I think this is really easy
Thanks
Sushant Duggal.
|
|
|
|
|
No. I don't use datagrids.
---
b { font-weight: normal; }
|
|
|
|
|
Yes, still trying to add a blank line to my datagrid. The user clicks a button and executes the following code:
DataTable dt = ds.Tables["Rest"];<br />
DataRow row;<br />
row = dt.NewRow();<br />
row.ItemArray = dt.Rows[0].ItemArray;<br />
row["PartNumber"] = strPartNumberInputReference;
But I always get "no row in position 0" error. I have been researching for about 2 hours and not finding anything useful in my case. Does anyone have an idea?
|
|
|
|
|
dt.NewRow() only creates a new row for you with the columns available.
After assigning your row value, you need to add it back to the DataTable.
If I'm not wrong, this should do it: dt.Rows.Add(row);
Hope that helps.
"Democracy is two wolves and a sheep voting on what to have for dinner" - Ross
Edbert
Sydney, Australia
|
|
|
|
|
Hi
I have some drop down lists and text boxes in my datagrid rows and whenever the selection is changed in the drop down box, I update the text of the text box for that row thru a javascript. However, I am not seeing the updated values (thru the javascript code) in the datagrid on postback to the server.
Is there a way to get around this problem?
Thanks
|
|
|
|
|
hi tsramkumar,
as u are modifying the value of textboxes in client side it will not be seen by the server.Rather use some hidden textboxes to hold the value of datagrid textboxes.
Tirthadip
|
|
|
|
|
I'm using the SiteMapPath control which works fine on most of my pages. However, it doesn't work at all on some. For example, there are newsitems on the front page which are viewed/edited/created from ~/News/Default.aspx. For different operations it appends parameters for the url. For example, to edit an news item the path looks like this: ~/News/Default.aspx?op=Edit&id=XX (or more succinctly, ~/News/?op=Edit&id=XX) where XX is the unique id in the database for the news item in question. In my Web.sitemap file I have:
<br />
<siteMapNode url="News/Default.aspx" title="News"><br />
<siteMapNode url="News/Default.aspx?op=AddNew" title="Add New"/><br />
<siteMapNode url="News/Default.aspx?op=Edit" title="Edit"/><br />
<siteMapNode url="News/Default.aspx?op=Delete" title="Delete"/><br />
<siteMapNode url="News/Default.aspx?op=Read" title="Read News Item"/><br />
</siteMapNode><br />
Now, because there is more appending past the op=Edit the SiteMapPath doesn't display that you are on the Edit page, but rather just the plain old Default.aspx page. I have tried putting an astericks on the end thinking maybe it would work like a wildcard, but it did not. Is there anyway to overcome this problem or should I be looking into passing the id's with session variables?
|
|
|
|
|
There are two options which you can try:
+ Use the SiteMapResolve event to modify the URL, you can see more via the example[^]:
+ Use the urlMappings[^] to rewrite the URL, in the Web.sitemap you can define the SiteMapNode like this:
<siteMapNode url="News/AddNewNews.aspx" title="Add New"/>
and in the web.config file, you can add an entry in the urlMappings:
<urlMappings>
<add url="~/News/AddNewNews.aspx"
mappedUrl="~/News/Default.aspx?op=AddNews" />
</urlMappings>
|
|
|
|
|
The SiteMapResolve options intrigues me so I attempted to do it using the MSDN site as a guide but I cannot get it to work at all.
I have assigned the event handler in both Page_Load and On_Init and nothing happend:
EDIT: not at the same time
<br />
SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(this.FixSiteMapPath);<br />
And this is the super simplified handler just so I could see it work, which it doesn't.
<br />
protected SiteMapNode FixSiteMapPath(Object sender, SiteMapResolveEventArgs e)<br />
{<br />
SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true);<br />
SiteMapNode tempNode = currentNode;<br />
<br />
tempNode.Url = "News/Default.aspx?op=Delete";<br />
return currentNode;<br />
}<br />
What I don't understand is why the tempNode is created and why it returns currentNode? I've tried that way and just straight modifing currentNode, neither worked at all. I tried to debug the code, putting a break point in the handler, but I never hit it? So I put some code in the event handler unrelated (hid a control on the page) and when the page rendered the control was, in fact, not visible so I know I'm actually getting inside the handler, but no dice.
-- modified at 12:00 Tuesday 27th June, 2006
|
|
|
|
|
+ Because this is the static event, so if you register the event handler in the Page scope, then you might consider unregister the handler. Another option to wire up the event handler is to use the Application_Start event in the Global file or register in a static class.
+ IMO, no need to use the tempNode variable as the tempNode and currentNode are actually the same.
+ To edit the displayed title properly, you can detect the op parameter in the SiteMapResolve event handler, then edit the Title property of the currentNode object. Another option is to create your own custom SiteMapProvider so that it is able to pick up the right node based on part of the request url instead of the entire.
|
|
|
|
|
Hello,
I am trying to create a new column in my DataGrid. I would like this column to be a TemplateField. This field for example should have a TextField and a Button. When the button is pressed I want to run a query with the data from that row (ie the primary key) and the data in the TextField mentioned above. This query should not be one of the Select, Update, Insert, Delete functions. Ie - I would like to create an additional query, and have this button call this query (much like the Update button would call the Update query).
Does anyone have any advice for this?
EDIT:
I've followed the following steps to get this far:
-Add New Item > DataSet
-Created the Select, Update, Insert and Delete queries - as well as another query that I want to be able to access but have no idea how to.
-Add New Item > Web form
-Added DataGrid (from toolbox)
-Added a new datasource that connects to the DataSet
-Enabled editing,deleting,updating
-Added a new Template column
-Put a Button in it
I hope this is descriptive enough. I am using Visual Studios 2005 with C#.
|
|
|
|
|
in the asp guestbook in the url "http://www.codeproject.com/asp/asp-guestbook.asp" can anyone please tell me wat the use of the " <input type="hidden" name="ispostback" value="1"> " ....
|
|
|
|
|
hi,
probably its a HTML Hidden Textbox control.
Tirthadip
|
|
|
|
|
Hello all.
I'm trying to implement something but since I'm not sure if it's possible (and also because I don't know very well this area) I'm getting some dificulties. Maybe someone can help me.
I have the following scenario:
1 webserver with a portal application
1 webserver on a diferent network and location with another web application
My users access to the portal application and authenticate with theis own login and password.
Next they have available on the portal one link to the other web application which they click and access to it.
Since the other application is also protected with forms authentication, I need to know the users when he first access to the other application (it's similar with single-sign-on).
I need to call from the portal one webservice that is located in the other application. Then this webservice authenticates the user (user details are sent on the webservice call) on the other web application and return only an OK to the portal.
When the user click the link, he is redirected to the other application and is already identified automaticaly.
Is someone here that already do anything like this ?
Does anyone know if this is possible ?
Thanks in advance for your replies
Filipe Peixinho
Aveiro - Portugal
|
|
|
|
|
how to write crystal reports in asp.net.
how to add column dynamically and increase the numbers in the column.
mail id : adhari2004@yahoo.co.in
-hari krishnan
hari krishnan
|
|
|
|
|
I'm using vs 2002 and the other day, I was suddenly no longer able to debug my asp.net web project. I receive the following error when I try to debug:
--------------------------------------------------------------------
"A project with an Output Type of Class Library cannot be started directly. In order to debug this project, go to the Debugging tab under Configuration Settings in Project Properties, and set the Start Action to Start External Program or Start URL. Alternatively, you can add a non-library project to this solution that uses a reference to this project and set it as the startup project."
----------------------------------------------------------------------
I tried following those instructions (even though I wasn't using "Start External Program" or "Start URL" before and everything was fine then) but I'm still receiving the error.
I don't know what it is that I've changed in my project to force this error to appear. Any ideas on how to correct this?
Thanks in advance.
-Goalie35
|
|
|
|
|
I had this happen to me the other day and it drove me crazy until I realized that somehow another project in my Solution had been set as the "StartUp Project" (aka, the project that is run when you click play). Just right-click on the REAL project from Solution Explorer you'd like to start and choose "Set as StartUp Project"... The selected project will be bolded to confirm. Yes, it is frustrating that it seems to override the startup options on the Project Properties dialog, caus that's where I checked first too. hah.
|
|
|
|
|
That was it. Thanks swilly1!
lol
To try to resolve this problem, I was looking into changing values within some vs.net XML files and I had already removed all changes I made to my files the day this issue happened (I saved a copy of these changes though)....it's just funny how my largest headaches always turn out to be fixed through the click of a single button.
Thanks.
-Goalie35
|
|
|
|
|
I am trying to use the ICallbackEventHandler interface.
I create a callback function as below:
string src = Page.ClientScript.GetCallbackEventReference(
this,
"arg",
"ClientCallback",
"ctx",
"ClientErrorCallback",
false);
string mainSrc = @"function PrintComplete(arg, ctx)
{alert(arg); " + src + "; }";
Page.ClientScript.RegisterClientScriptBlock(
this.GetType(),
"PrintComplete",
mainSrc,
true);
Now I add a button to my page and hook it up to a click event handled on the page along with the callback funtions.
test
function ClientCallback(result, context)
{
alert(result);
}
function ClientErrorCallback(error, context)
{
alert("Error in callback");
}
function test()
{
PrintComplete(5, "test");
}
This all works fine. Now if I try to call the test function from another script created with RegisterClientScriptBlock I get the call into PrintComplete but no call back to the server.
Any ideas? Is there a difference when running a script on the page versus a RegisterClientScriptBlock script?
Thanks,
Todd
|
|
|
|
|
If you run code from a block created with RegisterClientScriptBlock, the code will run while the page is loading. The only things that are available at this time is in the code above the script.
There are three possible reasons why the postback doesn't work:
:: The function for callback hasn't been written to the page yet.
:: The form fields used by the callback hasn't been written to the page yet.
:: The form is not fully loaded, so it can't be posted.
I don't know exactly which of those three that is the actual reason. Either way, the reason that it doesn't work is that you are trying to make the postback before the page is complete.
---
b { font-weight: normal; }
|
|
|
|
|