|
Ok then didn't think of it that way!
I have added a column into the table the repeater is created from. the onItemDataBound event is called ItemDataBound? I assume this is the one that you mean? Now sorry to be so dim but I am not sure how I am supposed to get the data in my Column out?
I am using this
<br />
Protected Sub repResults_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles repResults.ItemDataBound<br />
If repResults.Items.Count > 0 Then<br />
e.Item.... ' Dunno what goes here? :-S<br />
End If<br />
<br />
End Sub
Ok then I assume that this is where I put my code to check the time compared to the stored time. Only really want those items created in the last 5 mins to be highlighted. But i am a bit clueless as to how to get my the exact item out and how to then go about highlighting the row(I assume its a case of background.color.)
The other thing is does the even ItemDataBound get called for each cell in the repeater or is it each row? couldn't find that out anywhere?
Thanks for your help so far tho...excellent idea, just wish i could pull it off!
Cheers
Ian
|
|
|
|
|
You'll want something like this in your ItemDataBound event handler:
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim dr As DataRow = e.Item.DataItem.Row, DataRowView
Dim d as Date = CDate(dr("LastUpdate"))
' now compare this time with "Now" and if within appropriate time-frame, highlight row...
End If
It gets called for each row...
How you then highlight the row is another matter...! I'm pretty sure I've seen articles on CP about this... or Google it - the answer is out there...
cheers
Fred
|
|
|
|
|
I have ended up not doing it that way! sorry...
sorry i have left work now so I don't have the exact code in front of me so will prob make a mistake
in the tag in the html on the repeater I have added
>
then in the code behind added a function
<br />
Function highlightNewRow(ByVal dt as String) as String<br />
<br />
' in here i then converted dt to a datetime and got the time as now into<br />
' another variable.<br />
<br />
if (dt_now - dt_dat) < New Timespan(0, 5, 0) then<br />
Return "style='Background:Red;'" 'Realise this is prob wrong, but can't remember what i used in the actual bit I did :)<br />
End If<br />
<br />
Return ""<br />
<br />
End Function<br />
If you want when i get back into work tomorrow I can post the actual code I used.
Thanks for your help tho...it was reading your intial bit about getting the data item back that made me realise I could use the database and do it that way. It was most helpful.
Cheers
Ian
|
|
|
|
|
That's great - it's always good to figure out your own answer! Don't worry about code - I can see what you've done.
cheers
Fred
|
|
|
|
|
Thanks Fred,
I only just started a new job and begun learning asp.net as part of it. Never used it before so its a big learning curve for me. I have to say how great a community this is and how friendly people are on here helping misfits like me out!
Thanks for taking the time Fred.
Cheers
Ian
|
|
|
|
|
Hai,
I'm getting one error warning as "There is no source code available for the current location" at the time of debugging using breakpoint. Due to this error i can't able to open a popup window. I'm using AjaxControlToolkit in my application.
Regards n Thks
Sam.M
|
|
|
|
|
Are u calling a web service somewhere whilst debugging?
I get this error sometimes when calling a web service method.
|
|
|
|
|
I had posted this question couple of days ago but still not able to get the answer. I want to Get HTML by Executing URL on Server. I have got the HTML but problem is this Current Session Values are not being sent. I can't use query string I have to use current sessoin values!!! Any Help will be highly appricated!!!
|
|
|
|
|
Perhaps it would help if you were a little more specific about what you're doing... Are you normally able to read session values on different pages of the same application? If so, what is different about what you're doing in this case?
Fred
|
|
|
|
|
Thanks for ur reply!
Actually my code is!
Dim objWebClient As New WebClient<br />
Dim aRequestedHTML() As Byte<br />
aRequestedHTML = objWebClient.DownloadData(strURL)<br />
Dim objUTF8 As New UTF8Encoding<br />
Dim strRequestedHTML As String<br />
strRequestedHTML = objUTF8.GetString(aRequestedHTML)<br />
GETHTMLStream1 = strRequestedHTML
The request(URL) is sent to the server which returns the HTML. Now Problem is this request doesn't able to retrieve session values.
Session values are being reterieved on other pages.
|
|
|
|
|
Well no, it won't... Session values (SessionID anyway) are passed back and forth between the browser and the server whenever a page is requested - a form of cookie; this is how it knows which session values belong to which client - and just passing the URL to the server won't send the session values too. You'll need to re-think your model....
Fred
|
|
|
|
|
Do you have any suggestion regarding this!!!
|
|
|
|
|
Not really, I'm afraid.. if you really need to do it this way, I guess you'll have to pass the session variables as paramters of the url - if you're worried about security, you'll need to encrypt them first.
Either that, or go back to the drawing board and see if there isn't another way to achieve whatever it is you're trying to do...
Good luck - sorry I cna't be more help...
Fred
|
|
|
|
|
Hi All,
With this below code i am able to print the datagrid. The problem now is i am able to print only part of the data grid, that too first page as empty, second page with part of the content and third page again empty.. What might be the reason.. I am able to scroll through the datagrid .. How can i print the entire datagrid.. Please anyone help me..
here i am sending Datagrid object to strid..
<script language=javascript>
function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML=strOldOne;
}
</script>
Thanks n Regards,
Umashanker.K
|
|
|
|
|
Are all your columns fitting on one page? You might get some weird printing truncating of columns if they don't fit on one page. Another question is if you have paging turned on. You would need to turn paging off so that all the rows show up.
Hope that helps.
Ben
|
|
|
|
|
Hi kubben, As u see my previous question my problem here is i am not able to print in continous order,even i am able to view the contends of the grid with scoll bar help..While printingand print preview the problem comes , how can i rectify. If i give window.print() for whole of the main page, not specifying the grid alone i am able to print the whole screen with other grid in the pages too.. plzz help a fessible solution for this.
Thanks & Regards
umashanker.k
|
|
|
|
|
You know it might be a good idea to see what sort of html doc you are creating.
Change your script to look like this:
<script language=javascript>
function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf=0,top=0,width=800,height=600,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
prtContent.innerHTML=strOldOne;
}
</script>
So now the new window is larger and you can view the source to see what the html looks like.
I am guessing that the what you are writing to the page with you document.write isn't exaclt what you want.
Ben
|
|
|
|
|
Still the problem exists ben.. i even changed scrollbar setting too.. but then the same problem comes.. any suggestions
Rgrds
umashanker
|
|
|
|
|
If printing the whole page works. And printing part of the page does not work. Then issue is in the html. So you should be able to view the source of the full page and then view the source of the part of the page you are trying to print. You should be able to see the differences in the html which should help in why the part of the page isn't printing. without seeing the html it would be hard to say what is going on.
You may be missing some tags.
Ben
|
|
|
|
|
hello
How to implement remember me next time feature for login control in asp.net 2.0. if anyone knows plz give some idea.
bye
|
|
|
|
|
Login Control: builtin control for user autentication in it there is two textboxes(UserName and Password) and one CheckBox("Remember me next time") and a button(Login).
the Remember me next time check box is not working bydefault. i m doing that in my way below is the code for Working "Remember me next time" checkbox.
first we have to put login control on page like below
<asp:login id="Login1" runat="server" onloggedin="Login1_LoggedIN">
then do this code on Login1_LoggedIN Event like below
protected void Login1_LoggedIN(object sender, EventArgs e)
{
CheckBox rm = (CheckBox)Login1.FindControl("RememberMe");
if (rm.Checked)
{
HttpCookie myCookie = new HttpCookie("myCookie");
Response.Cookies.Remove("myCookie");
Response.Cookies.Add(myCookie);
myCookie.Values.Add("Email", this.Login1.UserName.ToString());
myCookie.Values.Add("Pass", this.Login1.Password.ToString());
DateTime dtExpiry = DateTime.Now.AddDays(15); //you can add years and months too here
Response.Cookies["myCookie"].Expires = dtExpiry;
}
}
and then do this code on Page_Load Event
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.Cookies["myCookie"] != null)
{
HttpCookie cookie = Request.Cookies.Get("myCookie");
string emailID = cookie.Values["Email"].ToString();
string password = cookie.Values["Pass"].ToString();
if (Membership.ValidateUser(emailID, password))
{
FormsAuthentication.RedirectFromLoginPage(emailID, true);
}
}
}
}
think its useful for u
i find this code from codeproject only......
bye
naresh.s.s
|
|
|
|
|
thanx for ur help. but i am confused that in this code where is the connectivity with database where we can check user name and pwd in database table. Which user name and pwd should be given to login for this code. When i give any user name and pwd it will give me error like "Your login attempt was not successful. Please try again."
Plz help me out for this.
bye
|
|
|
|
|
nareshss wrote: the Remember me next time check box is not working bydefault
It is?
only two letters away from being an asset
|
|
|
|
|
yes it is not working bydefault. what to make it working ? any code is there?
plz if you have idea then post it
|
|
|
|
|
hello,
How to store this user name and password in encrypted format in cookie?
bye
|
|
|
|