|
I have a situation where I need your help. I have home.aspx page, which is consuming three frames as Leftmenu, TopMenu and MainContent. As name suggests leftmenu is for lefthand side menus, Topmenu is for company logo etc and maincontent iframe is for all other pages display which are selected by user from LHS menu.
I am displaying User name through session value on TopMenu iframe. This session is coming from default.aspx page.
Now problem start from here…Application provides the flexibility to user to change the user name from inside the application through one menu option. So for this we had provided an interface which gets open in mainContent iframe. On click of Submit button, I reset the value of session but it is not reflecting on TopMenu page as this is on different iframe.
If i do F5 then value get change on topmenu.aspx.
I tried to refresh the same page through JavaScript also but I am having bad luck as of now….Please let me know the best and shortest way to do so...
Amit
|
|
|
|
|
call a js function on clientclick event of submit button, and refresh the top frame page like this
window.parent.frames("topframe").location="topframepage.aspx"
i hope this will work.
many thanks,
adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
No it does not help....Any other suggestion
|
|
|
|
|
hi
i am dev a web application in visual web dev express..
wen using the gridview control i wanted that the date column be formated in (dd/MMM/yyyy) format.
i m entering in the gridview EDIT ITEM option
{0:dd/MMM/yyyy}
this aint working.
how can i do this..
Kunal Piyush
|
|
|
|
|
If you are using the Eval method of binding it looks like this:
<%# Eval("Date", "{0 }")%>,
If you are using a boundfield it looks like this:
<asp:boundfield datafield="Dtm" sortexpression="Dtm" headertext="Date" htmlencode="False" dataformatstring="{0 }">
Finally if you use a DataBinderEval (that is what I suggest)
You have this:
<%# DataBinder.Eval(Container.DataItem,"Date").ToString("dd/MMM/yyyy") %>
The other two options you really can't give it the dd/MMM/yyyy format.
Hope that helps.
Ben
|
|
|
|
|
kubben wrote: Finally if you use a DataBinderEval (that is what I suggest)
You have this:
<%# DataBinder.Eval(Container.DataItem,"Date").ToString("dd/MMM/yyyy") %>
hey
i tried wat you said
on the page load event i wrote this
DataBinder.Eval(GridView1.Columns[10], "Date").ToString("dd/MMM/yy");
i couldnt get wat COntainer.dataitem meant.. there wasnt any optio for the same.. i used columns[10], since the date column was the 10th including 0..
but i get an error..
tostring only takes 1 argument..
please help
Kunal Piyush
|
|
|
|
|
In the gridview. You need to convert the column you want the date in to be an ItemTemplate. In the ItemTemplate you need a Label control. In the Text property of the Label control you need to put the this:
<%# DataBinder.Eval(Container.DataItem,"Date").ToString("dd/MMM/yyyy") %>
The page load event is not the correct place to put this code.
So if you look at your gridview in the HTML mode you will find the <Columns> node
YOu need code like this:
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lbDate" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"Date").ToString("dd/MMM/yyyy") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
NOTE the Date that comes right after the Container.DataItem is what ever your are calling your date field.
Hope that helps.
Ben
|
|
|
|
|
this is wat i did..
<asp:TemplateField HeaderText="Dt" SortExpression="Dt">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Dt") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Dt").ToString("dd/MMM/yyyy") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
still that error..
Error 1 No overload for method 'ToString' takes '1' arguments C:\Documents and Settings\Kunal\My Documents\Visual Studio 2005\WebSites\diag\User\viewalldoc.aspx 25
Kunal Piyush
|
|
|
|
|
Sorry I missed on thing:
'<%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem,"Dt")).ToString("dd/MMM/yyyy") %>'
That should work.
Thanks,
Ben
|
|
|
|
|
hey
now the program is compiling.. but again 1 problem.
when the grid is displayed the "Dt" column shows the whole HTML tag, instead of the date.
i am using VISUAL WEB DEVELOPER EXPRESS 2005.. is is a problem of obsolete tag.
Kunal Piyush
|
|
|
|
|
I am guessing there is an unbalanced quote or something. Include the code and I will see if I can see anything wrong with it.
Ben
|
|
|
|
|
i am including the code..
though there shud have been an error regardin an unbalanced tag..
but still
<asp:TemplateField HeaderText="Dt" SortExpression="Dt">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Dt") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%Convert.ToDateTime(DataBinder.Eval(Gridview1.DataItem,"Dt")).ToString("dd/MMM/yyyy"))%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Kunal Piyush
|
|
|
|
|
Your code:
Text='<%Convert.ToDateTime(DataBinder.Eval(Gridview1.DataItem,"Dt")).ToString("dd/MMM/yyyy"))%>'
Needs to be:
Text='<%# Convert.ToDateTime(DataBinder.Eval(Gridview1.DataItem,"Dt")).ToString("dd/MMM/yyyy"))%>'
That should do it.
Ben
|
|
|
|
|
hey ben
thanks a lot.. problem solved.. thanks again..
Kunal Piyush
|
|
|
|
|
Sorry it took so long.
Ben
|
|
|
|
|
hey.. i need to be sorry... didnt take in consideration about the brackets..
also.. why did we use "container" keyword.. we were using a gridview..
Kunal Piyush
|
|
|
|
|
In this case the Container is referring to the Dataset or dataTable or dataview that is bound to the gridview. When you use DataBinder.Eval you always have to use container.dataitem and then pass in the field you are looking for. The Bind method does the same thing it is just behind the scenes.
Ben
|
|
|
|
|
Hi,
I am an application in ASP.net 2.0with c#.
I would like to use FileUpload web control with Atlas In my application. If I remove the atlas property from my application then FileUpload Web Control is working well. But using Atlas property FileUpload is not working.
Is there any way to use FileUpload Web Control along with Atlas in my application?
Any help is appreciated.
Regards
Rajesh
rajesh
|
|
|
|
|
It doesn't work because the form type must be sent as multipart/www-encoded (I forget the exact string but its something with "multipart" in it). The Atlast async request is sent as a normal POST with just form field values. Google it or search on the ASP.NET AJAX forums, you won't be the first with this problem.
|
|
|
|
|
|
I have the following code in my application...
Protected Sub gridTerms_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gridTerms.RowDataBound
Dim strMsg As String
If (e.Row.RowType = DataControlRowType.DataRow) Then
If (e.Row.FindControl("lnkDelete") IsNot Nothing) Then
strMsg = "return confirm('Please confirm. Delete payment term " & Trim(e.Row.Cells(2).Text) & "?');"
CType(e.Row.FindControl("lnkDelete"), LinkButton).OnClientClick = strMsg
End If
End If
End Sub
For some reason the contents of this cell (which is a code) appears blank in the debugger and the JavaScript confirm shows an empty string in the message. The GridView appears fine but even investigating the value of e.Row.Cells(2).Text in the debugger reveals an empty string. Any ideas??
|
|
|
|
|
In my experience with this stuff, sometimes you get literal controls inbetween your actual controls in the cell. I am guessing that your text might be in cells(3) instead of cells(2). Just a stab in the dark.
Hope that helps.
Ben
|
|
|
|
|
Thanks for the reply. Actually, I investigated cells (0) through (4) in the debugger. All show empty strings, yet the GridView is populated with the propery data. This seems like it should be a no-brainer so it's really puzzling.
|
|
|
|
|
You know when I have added confirm javascript type stuff to delete buttons, I have used a For Each loop in the gridview databound event. That way I can go through each datarow find the control and add the javascript. That sort of seems like what you are trying to do.
Hope that helps.
Ben
|
|
|
|
|
Is this formatted text? I always had trouble getting the value from the cells that contained formatted text, maybe you should try to get the innerHTML.
Cleako
|
|
|
|