|
Have you tried setting a breakpoint to see what's happening ? This code does n't change the datasource at all, it just changes the button text and rebinds to the same sources they have.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yes - I set a breakpoint at the beginning of this event handler - I have removed the sql changes for clarity brevity
The issue I have is that the first time the event fires, the text displayed is changed (as expected). The second time the button is clicked, the event fires but the button text (which I am using in the switch) remains the same as the first click, triggering the same case again. I think the issue is something to do with the postback - the navigation tree collapses on postback.
My Page_Load event is:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (User.Identity.Name != "")
{
if (Session["userName"] == null)
Session["userName"] = Requestor.user_name(User.Identity.Name, 3);
if (Session["deptname"] == null)
Session["deptName"] = Requestor.dept_name(Session["userName"].ToString());
string deptname = Session["deptName"].ToString();
if (!Requestor.Valid_User(User.Identity.Name))
Response.Redirect("dberror.htm");
else
{
Navigator.FillTreeMenu(NavTree, deptname);
}
lbl_User.Text = Requestor.user_name(User.Identity.Name, 1);
}
else
Response.Redirect("usernameerror.aspx");
SQLQueued.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
SQLQueued.SelectCommand = "cp_Get_Queued_Info";
gvw_totals.DataBind();
}
}
In addition to the button misbehaviour, lbl_User.Text gets blanked. I think it has to be a viewstate/caching/compilation thing..?
|
|
|
|
|
OK - "problem" solved. It was a viewstate issue.
Some idiot had discovered that disabling the viewstate on a slow-loading page improved performance. And decided to do the same thing on every page. Including the Master Pages.
Which is why enabling/disabling the viewstate on the content page did pretty much zip.
My apologies for wasting your valuable time.
Of course had I been documenting my modifications as I went along, I might have twigged a little quicker...
|
|
|
|
|
How would i specify a colour for a button
e.g.
btbutton.color = color #ffffff
i need to set it to a custom # color
thanks
|
|
|
|
|
Use the FromArgb method to create a color from color components:
btbutton.color = Color.FromArgb(255, 255, 255);
or
btbutton.color = Color.FromArgb(0xff, 0xff, 0xff);
If you want to specify a single hexademial value, you have to specify the opacity also:
btbutton.color = Color.FromArgb((int)0xffffffff);
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
<asp:TemplateField > <ItemTemplate>
<%-- <asp:LinkButton ID="lnkReplyHeading" runat="server" ><%# DataBinder.Eval(Container.DataItem,"u.username") %></asp:LinkButton>--%>
<asp:LinkButton id="lnkusername" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"u.username")%>' commandname="ss" > </asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
System.Data.DataRowView' does not contain a property with the name 'u'.
modified on Tuesday, February 19, 2008 8:43 AM
|
|
|
|
|
Hi Ritu!
Can you plz explain the problem in detail. I can't understand what is the problem.
|
|
|
|
|
ritu4321 wrote: ]]>
Try using,(remove 'u.')
<![CDATA[<%# DataBinder.Eval(Container.DataItem,"username")%>]]>
|
|
|
|
|
Hello there guys.
I have a little web application in ASP.NET but now I have errors I totally dont understand.
It says "ASP.NET Runtime error :Could not load file assembly 'System.AddIn Version = 2.0.0.0, Culture = Neutral, Public Key Token = 603F5F7F11D0A3A"
I have no idea what this means guys.I tried google.
Nothing.
kagiso
|
|
|
|
|
I'm getting this error from a page that has been edited. Neither the aspx nor the code behind files are asking for this field any longer, and the stored procedure has been changed and does not include the field. Why is it falling over on the live server? It runs perfectly well on my local machine in debug? Is there some kind of caching in IIS that I need to flush in order to use the new version of the pages?
Any suggestions as to where to look?
|
|
|
|
|
Did you remember to upload the compiled .dll to your live server? If you just sent the .aspx then you've not updated the code-behind.
|
|
|
|
|
I've been using the Visual Studio "Copy Website" option, copying the aspx and aspx.cs files - never had a problem before...
OK - I've just tried an iisreset and same result - I think the issue may be that I have a cached binary somewhere (perhaps on the ISA server).
modified on Tuesday, February 19, 2008 8:43 AM
|
|
|
|
|
Resolved by deleting the files from the server and re-publishing. Still not sure where the old files were being cached.
|
|
|
|
|
I want it like this: when users try to access some page, if the page is login.aspx or permitted by role, then let it go; but when it's denied by role config, I want kept signed in and to a warning page.
For now, it's forced to sign out and redirect to login.aspx.
|
|
|
|
|
Friends,
I want to hide the item of last row named(Down) inside my gridview. It is a linkbutton. I have already done how to hide first row but I don't understand how can I find the last row or total rows inside the gridview.
To hide the first row I am using following method
< asp: linkbutton ID="lblUp" runat="serveR" Font-Underline="true" ForeColor="blue" Text="Up" Visible="<%# IIf(CType(Container, GridViewRow).RowIndex = 0, false, true) %>" CommandName="MoveUp" CommandArgument="<%# Container.DataItemIndex %>" >
Please note that I am using this linkbutton in Item Template.
Please help me in this regard.
|
|
|
|
|
Please
1 - don't double post
2 - use a header that makes sense
You will need to store the number of rows in your data source, or the size of a page, then you can write similar code to work based on that data. Without the row count, you're kind of hosed.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Friends,
I want to hide the button named down inside Item Template on last row. How can I do this.
For first row I have done this
<asp:templatefield>
<itemtemplate>
<asp:linkbutton id="lblUp" runat="serveR" font-underline="true" forecolor="blue" text="Up">
Visible="<%# IIf(CType(Container, GridViewRow).RowIndex = 0, false, true)>" CommandName="MoveUp" CommandArgument="<%# Container.DataItemIndex %" >;
Now the same code I want to use to hide last row in Grid View. How can I do this.
|
|
|
|
|
hi Zeeshan Memon,
I think answer exists in your question only.
Zeeshan Memon wrote: <asp:linkbutton id="lblUp" runat="server" font-underline="true" forecolor="blue" text="Up">
Visible="<%# IIf(CType(Container, GridViewRow).RowIndex = 0, false, true)>" CommandName="MoveUp" CommandArgument="<%# Container.DataItemIndex %" >;
You should find RowCount of your gridview because your gridview is 0 based indexed. Just need to check index is RowCount-1 OR not then you show and hide your control.
<asp:linkbutton id="lblUp" runat="server" font-underline="true" forecolor="blue" text="Up"><br />
Visible="<%# IIf(CType(Container, GridViewRow).RowIndex = CType(Container, GridViewRow).RowCount -1, false, true)>" CommandName="MoveUp" CommandArgument="<%# Container.DataItemIndex %" >; <br />
Hope this will help you.
Thanks & Regards
Dilipv
|
|
|
|
|
Dear all,
Here i have developed an application in .net using vb.
My problem in my appilcation some forms are having postback events or selectitemchanged and so on.when the event is takes place the page is postback and the form appears.But while i am implementing at the client end,it is opening very slowly.
What might be the reason??and wat i have to do for fast access??
Theres no use if the appln is slow.
Pleasse give me some suggestion
Thaks in advance.
kissy
|
|
|
|
|
If it's fast foryou and slow for them, perhaps the problem is the speed of a database connection ? Or something like trying to connect to a database that exists on your machine and not theirs is causing the code to wait for a timeout
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello!
When I set enableviewstate="false" on my select-control its always empty on a postback. Shouldnt I be able to get hold of what´s displayed in the select-control? To clarify, my problem is this:
* I populate my select-control
* I choose on of the options and press a button with autopostback set
* When I'm at serverside the select has no value set
|
|
|
|
|
Do you know what viewstate is ? You turned it off, and so it's not there. Therefore, your value is not there.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello all
In my application i am creating a word document based in user
responses. Now i want to send the document as an attachment with the
mail as soon as the document is created. I want to send email in b
background. As soon as document is created i want to send mail
containing document as an attachment.
How can i do this? Please help me to solve..
I am creating document by two ways.
1) StringBuilder class.
2) Exporting datagrid to document.
Thanks.
Rahul
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
modified on Tuesday, February 19, 2008 8:08 AM
|
|
|
|
|
Create an instance of the Attachment class and add it to the
MailMessage.Attachments collection.
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
Hi
can u tel me how can i create instance of Attachment class.
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
|
|
|
|