|
hi sir
i am using html link button in my gridview for expand/collapse of nested gridview depending upon some status like "S" and "A" and for remaining status the expand/collapse should not visible please tell me how i can do null that particular cell value for remaining status so that there are no any exapnd/collapse html button.
please send a demo if possible.
|
|
|
|
|
I have a grid view whose rows contain, a linkbutton and a textbox. The textbox is initially not visible.
If any linkbutton is clicked, then the text-box in the corresponding row has to be made visible.
I am able to do this with server-side event. But its introducing some delay which is very irritating to the user.
If a client-side script can do this, it will boost the site performance.
How this can be achieved with Java Scripts ?
Apurv
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)
“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)
|
|
|
|
|
Instead of making the textbox invisible, set the CSS display to none.
You can do this like
TextBoxName.Style.Add("display", "none");
Call a javascript function on the OnClientClick of the linkbutton and set the display as visible of textbox here.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
i wrote it like this ...
<asp:LinkButton ID="lbkReply" runat="server" Text="Reply" OnClientClick="txtReply.Style.Add('display','none')" />
But, its not making the text box txtReply invisible ....
Apurv
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)
“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)
|
|
|
|
|
txtReply is the name on the server, it will have a mangled name on the client. Use txtReply.ClientID in server side code to emit the ID you need to use on the client. Even then, I thought you need to use document.getElementById("txtReply").Style.Add...
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I m devloping an online shopping website.........and in this i have to create menus in left side dynamically.....These menus will be created by the admin panel online....For e.g. First admin create Category then its sub-category and then product details and depending on these tree view menu will be created............i m totally confused which control to use create menu frm database and how to call information about specific product.........there can be n no. of categories and products..........shud i create a new page abt product everytime...........plz help me
Thank you
|
|
|
|
|
ankurdsharma wrote: .shud i create a new page abt product everytime.
No, that would be a mess. Create a single product page, which is passed an id and populates itself with a specific product from the DB, based on that id.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi,
I am creating a webapplication with three forms in asp.net/C# ,also I am using Sqlserver-2005.
In my application:
1)form(1) I am using a link button,and other textboxes plus buttons ; on its click the application will simply open a new form(form2); also I should tell you that I have alreday filled some textboxes in form (1) before clicking link button.
2)there are two text boxes in this form(2) and a button.
3)when the user clicks this button, all the text box data will be transferred to the form(1),and will be stored in textboxes there, also tthe user should also see the previous informations entered.
now the problem:
whenever I will run the application it will simply show an error message that form should have values coming from session id?
well, I tryed to solve it by simply copying form(1) as form(3)
form(1) wont have any data coming from form(2) and would simply send all its data to form(2), form(2) along with its data and form(1) data will be transferred to form(3)
any better technique of doing that
or
anyother suggestions or remedies?
thanks and regards
|
|
|
|
|
If you want to tell us what error you had, post the actual message. Pasting it into google is even quicker.
I'd make the forms controls on a single form, so viewstate can store the values for you, and you write code to move it between controls.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
HI Christian ,
consider the scenario below:
page(1)
session("empid")=txtempid.text;
textbox3=session("values").Tostring();
page(2)
txtempid.text= session("empid").Tostring();
session("value")=textbox3.text;
now simply consider this application to be running from page 1
|
|
|
|
|
Well, textbox3 will start with null, and if you go back and refresh, it will contain the text in the OTHER textbox3, given that you have two controls with the same names on two different pages. What is the issue ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
ok thanks for the answer, I didn't think about making it "null" oops!
shankbond
|
|
|
|
|
Hi
Im having a nightmare with a postback sequence so hopefully someone can give me ideas on how to solve this.
Hopefully I will be able to explain my issue correctly.
I have a Repeater on a page which contains a User Control in its Item Template
The User Control has (among other things) a place holder control.
Another user control is loaded dynamically with LoadControl (based on a database id) and added to the placeholder.
So basically I end up with
Repeater
- UserControl (PageComponentController)
-- DynamicUserControl
- UserControl (PageComponentController)
-- DynamicUserControl
etc
Repeater_ItemDataBound Snippet
CMS.Controls.PageComponentController pagecomponentcontroller = (CMS.Controls.PageComponentController)e.Item.FindControl("PageComponentController");
if (pagecomponentcontroller != null)
{
pagecomponentcontroller.PageComponent = pagecomponent;
pagecomponentcontroller.EditMode = _editmode;
pagecomponentcontroller.Zone = _zone;
pagecomponentcontroller.VirtualPage = _virtualpage;
}
PageComponentController onLoad Snippet
_component = (CMS.Components.BaseComponent)LoadControl(_pagecomponent.Component.UserControlPath);
if (_component != null)
{
_component.PageComponent = _pagecomponent;
_component.EditMode = _editmode;
_component.VirtualPage = _virtualpage;
_component.Zone = _zone;
phComponent.Controls.Add((UserControl)_component);
}
The UserControl (PageComponentController) contains two buttons "Edit" and "View"
Which then sets a property inside DynamicUserControl
This property is saved to the ViewState of the DynamicUserControl
public DAL.ComponentViews View
{
get
{
Object o = ViewState["COMPONENTVIEW"];
return (o == null) ? DAL.ComponentViews.View : (DAL.ComponentViews)o;
}
set
{
ViewState["COMPONENTVIEW"] = value;
}
}
First problem is this viewstate is not remembered (always null) on postback so the control always displays its default state rather than the selected view. All the controls are populated again and show, but not the correct state. Is there anyway to save the state of dynamically loaded controls?
Also, is it possible to tell which dynamic user control fired the postback?
With a postback all the page_loads fire for all the controls on the page.
The events wire up correctly (for the most part ) but i need to know in the page_load of the dynamic control not just if a postback occurred by if the postback was fired by that particular control.
Is there a way to do this?
Thanks
|
|
|
|
|
Tyrone Watt wrote: Is there anyway to save the state of dynamically loaded controls?
Sadly, your controls need to be created BEFORE page load, in order to participate in the reconstruction of the viewstate tree. Otherwise, the values are dropped. The alternative, is to store a hidden field in your page, and have javascript store the state of controls in that, because then you'll have something to set the state with, when you recreate the controls.
Tyrone Watt wrote: Also, is it possible to tell which dynamic user control fired the postback?
Same issue, really. No click event, unless the control existed before page load.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi
Thanks for that.
I have no problem creating the controls in PageInit instead but either way that doesnt seem to be the case.
The click event fires correctly after the page load, and the viewstate is set correctly in the "onclick" event, but it is not set in the page_load. So somewhere between the page_load and the onclick the viewstate is set back. Problem is I need to do things based on that viewstate before the click event or regardless of whether a click event occurred at all.
With the second question, maybe i didnt phrase it correctly. What I need to know is which particular control fired the postback in the page_load. So if i have 6 user controls on a page and control 3 fired the postback. On the page_load for the page and all 6 controls is there a way to tell that it was control 3 that did the postback, or is a javascript hack with a hidden field the only way.
As the event fires in the correct control, surely the must be some means of knowing which control fired the postback rather than just knowing that a postback occurred from one of the 6 controls.
Thanks
|
|
|
|
|
1 - if you create the exact same control tree, viewstate should be restored
2 - yes, I got that. If you have viewstate, then the sender property of the event is passed the control that fired it, so you can access it that way. In the absence of viewstate, you don't get an event at all. As soon as an event fires, cast the sender to the right type and then identify it from there.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
1. Thats what I thought, but its not... And as you mention in 2
Christian Graus wrote: In the absence of viewstate, you don't get an event at all.
Which puzzles me because the event fires, but the viewstate property is still null.
With 2, the "sender" in the onload is always the control itself, so unfortunately that doesnt help. Its in the onload that i need to know which control fired the postback, not in the onclick event(where the sender is the control that fired the event).
Thanks for you input so far, do you have any other suggestions i can try. Been beating my head against a wall for a while on this now and its starting to hurt...
|
|
|
|
|
Hi.. i want to convert datatime format to Date...i want to display On UI only date...
I am using below method its not working for me...
can anyone suggest me..
<br />
public static String GetShortDate(String sDateTimeValue)<br />
{<br />
return String.Format("{0:dd/MM/yy}", sDateTimeValue.ToString());<br />
}<br />
|
|
|
|
|
public static String GetShortDate(String sDateTimeValue)
{
DateTime _date = DateTime.Parse(sDateTimeValue);
return _date.ToString("d", DateTimeFormatInfo.InvariantInfo);
}
Have a look at the various formats here[^]
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
modified on Tuesday, June 23, 2009 4:09 AM
|
|
|
|
|
Hey..i tried with above method..i followed other methods also which you send me ..i,e very good link for beginners like me....eventhough i couldn't resolve that issue..
its throwing exception error like below..
FORMAT EXCEPTION UNHANDLED BY USERCODE...
converting from string to datetime parse the string to take the date before putting each variable datetime object into
How can i resolve ???
|
|
|
|
|
Hello,
Thank you for reading this post. Here is my situation. I am new to AJAX development. I have a gridview with 4 boundfield columns and 1 buttonfield column. I need to display a popup anytime a user hovers over the buttonfield column and popup a panel which has some database driven text and a button which says "Add this to my plan" and a cancel button on the popup. How do i associate a hovermenu extender to a buttonfield column with targetcontrolid? Does the hovermenu controller need to be associated in the rowcommand of the gridview? How does this need to be done. A code sample or a URL where someone has already done this will help my cause mightily ! Here is the code of what I have
<asp:UpdatePanel ID="updPanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<ASCPWebC:GridView
ID="gvProducts" runat="server" DataSourceID="odsProducts"
OnRowDataBound="RowDataBound" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true"
CssClass="datatable" CellPadding="0" CellSpacing="0" BorderWidth="0" GridLines="None" >
<Columns>
<asp:BoundField DataField="FieldA" HeaderStyle-CssClass="first" ItemStyle-CssClass="first" DataFormatString="{0Big Grin}" HeaderText="Field A" SortExpression="ORDER_DATE" />
<asp:BoundField DataField="FieldB" HeaderText="Field B" SortExpression="FieldB" />
<asp:ButtonField CommandName="SelectDescription" DataTextField="FieldC" HeaderText="Field C" SortExpression="FieldC" />
<asp:BoundField DataField="FieldD" HeaderText="Field D" SortExpression="FieldD"/>
<asp:BoundField DataField="FieldE" HeaderText="Field E" SortExpression="FieldE"/>
</Columns>
</ASCPWebC:GridView>
<asp:Panel ID="Panel1" runat="server">
<% --Here is popup panel,this needs to have some text and an add button,cancel link -- %>
</asp:Panel>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cblTest" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
Any and all help is much appreciated.
Thanks
RH
|
|
|
|
|
I have developed a test website in vstudio 2008. I published the site to http://localHost/WebAndASP/
I run the Web program in IDE and it opens up browser window to
http://localhost:3400/ and displays my page
I can also open up a browser window manually type in the above and view the page.
However I cannot do http://localhost/WebAndASP/Default.aspx
IIS has Website entry named WebAndASP. It is configures with low priority. The directory security is set to Anonymous access and Integrated Windows Authentication
When I right click on the Website node in IIS(5.1 btw) I get the same http 500 internal server error message.
Strange that it can execute with the :3400 but not locally.
I would like IIS to work without having to supply the :3400 or any of the other values
Help is greatly appreciated
Dale
|
|
|
|
|
How did you deployed your application on IIS ? Can you please check in which Port your web sites is running ? By default it should be 80.
Thank you !!
|
|
|
|
|
Yes its port 80
The port numbers assigned are random, based on what VStudio decides to use for its virtual server.
however once I publish the web app to the wwwroot directory, http://localhost/AppName should be all thats required, to the best of my knowledge.
|
|
|
|
|
We are moving to .NET slowly. We have an ASP.NET log-in/admin that has links to multiple ASP 3.0 sites. The problem we are having is the session timeout. I can not figure out a way to update the clock on the .NET side. Most of our users will use the Legacy side until we slowly convert them over. We decided that making a response.redirect specific "ping" pages in ASP 3.0 and .NET will not be a good solution. We have many independent sites that we are going to tie into this .NET "hub". But recoding all of the sites to use the "ping" solution is not what we are currently looking for. Right now I just set the .NET timeout to 60 min and hope for the best. Has anyone had this problem? What was your solution? Any suggestions?
Thank you in advance!
|
|
|
|