|
why you don't search for the solution rather tahn reposting and waiting
do you know that google is your friend
The Web Developer. Beirout-Lebanon
|
|
|
|
|
You would not say m not trying for the solution if you would have studied my post clearly.
I have mentioned everything ,
Try to help someone.
|
|
|
|
|
Hi Surender,
Dilip Here again, sorry for late response, i was busy....
so your problem is as
[1] if a user logs in and closes bowser close button instead of log out.
==> if user is log in and close browser then you can call a javascript function on body's(HTML tag) unload event and in that function you can all a server side function which will perform logout procedure. for that you can use ICallback interface or you can use XMLHttpRequest.
[2] if a user logs in and leaves doing nothing
==> in such situations, your session will be expired. and when session expires, you can do coding of logout in session_end event.
OK, May my suggesions helpful to you.
Regards
Dilip Patel
|
|
|
|
|
dilip_rollwala wrote: if user is log in and close browser then you can call a javascript function on body's(HTML tag) unload event and in that function you can all a server side function which will perform logout procedure. for that you can use ICallback interface or you can use XMLHttpRequest.
What if JS is disabled?
|
|
|
|
|
Thanks dilip for ur valuable suggistions......
i'll try to implement the said things
Thanks once again
cheers,
Try to help someone
|
|
|
|
|
surender939 wrote: if a user logs in and closes bowser close button instead of log out.
if a user logs in and leaves doing nothing.
You can write a SQL Job which checks the tables and update the flag which are expired. For this, you need to keep a timestamp which gives the last accessed time.
|
|
|
|
|
I have a gridview that has a column of textbox that users input something in textbox.I want to retrieve text of textboes after postback,so i wrote this code to store texts of textboxes in list and list in a session.but I don't know how to show them agian in textboxes.
my code to store text of textboxes:
protected void Button1_Click(object sender, EventArgs e)
{
List<string> qy = new List<string>();
foreach (GridViewRow gvr in GridView1.Rows)
{
TextBox q = (TextBox)gvr.FindControl("textbox5");
if (Session["quantity"] == null)
{
qy.Add(q.Text.Trim());
Session["quantity"] = qy;
}
else
{
((List<string>)Session["quantity"]).Add(q.Text.Trim());
}
}</string></string></string>
-----------------------------
and in pageloade i wrote this but I don't know how to continue it:
if(Session["quantity"]!=null)
{
List<string> temp=(List<string>)Session["quantity"];
foreach(GridViewRow gvr in GridView1.Rows)
{
TextBox tq=(TextBox)gvr.FindControl("textbox5");</string></string>
|
|
|
|
|
You can use the Grd Row Created Event
|
|
|
|
|
Just true the EnableViewState property of textvox or your grid.
|
|
|
|
|
the viewstates are true.I want to show text in textboxes agian after postback.
|
|
|
|
|
Hello,
I have a tag link with onclick() function(fnDelete). I am passing the string from the database.Eg: Here i want to pass the string(friend's).
since the string(friend's)is being with single quotes,the function "fndelete" is not called. And i am getting the script error as "Excepted ')'.So how can i pass the string(friend's) to that function?.
Can anybody help me please?..
Here is my code.
<asp:TemplateField>
<ItemTemplate>
<a id="del" style="color:Black; text-decoration:underline;" class="Itemlink" onclick="fnDelete('<%#DataBinder.Eval(Container,"DataItem.Name")%>')" runat="server">Delete</a>
</ItemTemplate> </asp:TemplateField>
function fnDelete(name)
{
alert(name);
}
|
|
|
|
|
use the replace method to add another single quote to the parameter
so instead of passing Friend's, you would pass Friend''s
|
|
|
|
|
No - if you're trying to write an apostrophe to a JavaScript function you need to escape it with an \
eg: friend's becomes friend\'s
|
|
|
|
|
Now it works when i Replace the single quotes
like
onclick="fnDelete('<%#DataBinder.Eval(Container,"DataItem.CatId")%>','<%#DataBinder.Eval(Container,"DataItem.Name").ToString().Replace("'", "\\'")%>')"
|
|
|
|
|
To correctly encode a string to put in a Javascript string literal, you have to escape both backslashes and apostrophes.
.Replace("\\", "\\\\").Replace("'", "\\'")
Of course, if you are absolutely sure that the string can never ever contain a backslash, you only need to escape the apostrophes.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
i have a list that I bind it to gridview.in this list I store id of products.my list is in a session..in itemtemplate column of this gridview I put a button , named delete , for deleting every row.i dont bind this gridview to sqldatasource .it binds to a list.the id of product is one of the columns of gridview.I want to when user click this button the id of that product remove from the list .how should I remove thi sid from my list and where should I write code.please help me.here is gridviewsource:
<asp:gridview id="GridView1" runat="server" autogeneratecolumns="False" height="140px" width="572px" showfooter="True" xmlns:asp="#unknown">
<columns>
<asp:boundfield datafield="product_id" headertext="product_id" />
<asp:templatefield headertext="name">
<edititemtemplate>
<asp:textbox id="TextBox1" runat="server" text="<%# Bind("category_name") %>"></asp:textbox>
</edititemtemplate>
<itemtemplate>
<asp:label id="Label1" runat="server" text="<%# Bind("category_name") %>"></asp:label>
<asp:label id="Label2" runat="server" text="<%# Eval("type") %>"></asp:label>
</itemtemplate>
</asp:templatefield>
<asp:boundfield datafield="degree" headertext="degree" />
<asp:boundfield datafield="package_type" headertext="package" />
<asp:templatefield headertext="price">
<edititemtemplate>
<asp:textbox id="TextBox2" runat="server" text="<%# Bind("price") %>"></asp:textbox>
</edititemtemplate>
<itemtemplate>
<asp:label id="Label3" runat="server" text="<%# Bind("price") %>"></asp:label>
</itemtemplate>
</asp:templatefield>
<asp:templatefield>
<footertemplate>
<asp:label id="Label3" runat="server"></asp:label>
</footertemplate>
<itemtemplate>
<asp:textbox id="TextBox2" runat="server" width="97px"></asp:textbox>
</itemtemplate>
</asp:templatefield>
<asp:templatefield>
<itemtemplate>
<asp:button id="Button3" runat="server" commandname="delete" cssclass="button" text="delete" />
</itemtemplate>
</asp:templatefield>
</columns>
</asp:gridview>
|
|
|
|
|
Hi,
For the GridViews RowDeleting event, access the ID and remove it.
Here is the steps to follow. After successful deletion re-bind the list to the GridView control.
1. For the delete button, set CommandArgument as the ID.
<asp:Button ID="btnDelete" runat="server" CommandName="delete" CommandArgument='<%#Eval("product_id")%'> />
2. For the RowDeleting event.
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
Button btnDelete = (Button)GridView1.Rows[e.RowIndex].FindControl("btnDelete");
if (btnDelete != null)
{
int iProductID = Int32.Parse(btnDelete.CommandArgument);
if (Session["lstProduct"] != null)
{
List<Products> lstProducts = (List<Products> )Session["lstProduct"];
Products oProducts = lstProducts.Find(delegate(Products p) { return p.product_id == iProductID; });
if (oProducts != null)
{
//Give a message : record deleted successfully.
lstProducts.Remove(oProducts);
Session["lstProduct"] = lstProducts;
GridView1.DataSource = lstProducts;
GridView1.DataBind();
}
}
}
}
Hope it helps,
Thx,
Gayani
|
|
|
|
|
Products oProducts = lstProducts.Find(delegate(Products p)
what is delegate?I did't use product class.here is my code:
if (Session["basket"] == null)
{
List<string> pid = new List<string>();
pid.Add(productid.Trim());
Session["basket"] = pid;
}
else
{
((List<string>)Session["basket"]).Add(productid.Trim());
}
</string></string></string>
Button btnDelete = (Button)GridView1.Rows[e.RowIndex].FindControl("btnDelete");
I don't have RowIndex in my smart list.
modified on Friday, September 5, 2008 3:39 PM
|
|
|
|
|
Hi Gurus,
I have a tab container and under a tab panel I have datagrid .
When I dynamically populate the datagrid I find its height is more than the height of the tab panel / container. I do not get scrollbars for the tab panel. It gives me effect that my datagrid is overlapping my tab container.
How should I make datagrid remain inside the tab panel but still let it grow and in turn have scrollbars.
My code is
<ajaxToolkit:TabPanel ID="TabPanelResult" runat="server" HeaderText="TabPanel1" >
<HeaderTemplate>Result</HeaderTemplate>
<ContentTemplate>
<div align=center
<asp:datagrid id=dg_SearchResults runat="server" Width="262px" Font-Names="Verdana" Font-Size="7pt" PageSize="5" HorizontalAlign="Left" AutoGenerateColumns="False" AllowSorting="True" AllowCustomPaging="True" ForeColor="Black" CellPadding="2" BackColor="White" BorderWidth="1px" BorderStyle="Solid" BorderColor="#999999">
<FooterStyle Wrap="False" BackColor="#CCCCCC">
..
..
..
..
</TABLE>
<%--</asp:Panel>--%>
</div>
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>
Please give me some feedback.
regards
vijay
|
|
|
|
|
Hi guys
I need to write the following sql query:
select * from table where field1 not in (select field2 from table2 where field3 like '%05/09/2008%' and sum (field3) < 1)
Basically I need to put a sum in the where statement, is it possible to do this?
thanks
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Dear .netman,
first of all you can not use aggregate functions (like sum, avg) without using Group by clause.
and another thing also you can not use aggregate functions in where clause. you have to use Having clause with group by clause.
select * from table where field1 not in (select field2 from table2 where field3 like '%05/09/2008%' gruop by field2 having sum (field3) < 1)
Regards,
Dilip Patel
|
|
|
|
|
try this
select * from table where field1 not in (select field2 from table2 where field3 like '%05/09/2008%' and (select top 1 sum(t1.field3) from table2 as t1 where t1.field3= table2.field3 group by t1.field3) < 1<br />
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Hi
OK Im not sure how to write this query but Im going to explain because the code above works but it doesnt do what I want.
Basically I need to do check how many rows in another table contain the number 2 and match a certain date.
so something like
select * from table where field1 not in (select field2 from table2 where field3 like '%05/09/2008%' and sum number of fields containing '2' < 1)
any help on this would be great
thanks
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Which result you get from my query and which result you want to get?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Well to be honest i used the others guys query because I didnt understand what you mean by t1
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|