I have a DataGrid that has event handlers bound to SortCommand and PageIndexChanged. How can I determine if those event handlers are about to be called, say on page_load? These events will fire just fine after page_load, but I'd like to know at page_load if they are to be fired.
I'm a newbie here. I have created a custom control that requests a set of data from a user. However, I want to be able to have a variable number (dictated by the user) of these data sets entered on each page. How can I create and refer to a variable number of instances of a user control on a single page? It's hard to explain in words, but I'm basically looking for some way to do what amounts to the following:
[code].....
Is there a straightforward way of doing this? I haven't been able to find a clear answer via Google, which brought me to this group.
I have a PDF document with a number of text fields, several of which have a maximum length - namely, a maximum number of allowable characters. Is there a way using iTextSharp to determine this setting? Here's the code I have so far:
Dim reader As New iTextSharp.text.pdf.PdfReader("Foobar.pdf") Dim inputFields As IDictionary(Of String, iTextSharp.text.pdf.AcroFields.Item) = reader.AcroFields.Fields For Each key As String In inputFields.Keys Dim PDFFieldName As String = key Dim MaxFieldLength As Integer = ??? ... Next
I need to set MaxFieldLength to the number of allowable characters for the current form field being iterated over.
I have two custom validators that are in the same validation group. This validation group is launched by one button. My question is, in what order will the custom validators fire in? It appears that the validator that is placed earlier in the aspx page fires first, but I don't want to rely solely on this.
I have read your article from aspsnippets.com about custom paging it really work, but there are a problem that if there are more record in database (2000 to 5000) than  number of page index  will be goes in large number. like 1 to 200, any way which can divide it  like 12345678910...2000.
I've written a questionnaire application in ASP.Net that takes people through a series of pages. I've introduced conditional processing, or branching, so that some pages can be skipped dependent on an answer, e.g. if you're over a certain age, you will skip the page that has Teen Music Choice and go straight to the Golden Oldies page.
I wish to display how far along the questionnaire someone is (as a percentage). Let's say I have 10 pages to go through and my first answer takes me straight to page 9. Technically, I'm now 90% of the way through the questionnaire, but the user can think of themselves as being on page 2 of 3: the start page (with the branching question), page 9, then the end page (page 10).
How can I show that I'm on 66% and not 90% when I'm on page 9 of 10?
For further information, each Page can have a number of questions on that can have one or more conditions on them that will send the user to another page. By default, the next page will be the next one in the collection, but that can be over-ridden (e.g. entire sets of pages can be skipped).
I created a custom forms authentication and membership provider and it seems to work fine opening up in WAT, creating roles and adding users. Also when I in my mvc app use it to log users in, it works fine. However it seems to fail to determine a user's role (no errors, but just jump over User.IsInRole(...) lines and Roles.GetRolesForUser(); comes up empty. I got a gut feeling I did something wrong with my configuration, so for now I'll post just that:
I know an ASP.NET app can have as many aspx pages as you want but after hitting a certain number of them (over 100) should I consider a different design? Or, as the months/years go by do I just keep adding more and more pages to my app?
I have a custom control that is based off the gridview control located at: here The control is basically a gridview that automatically creates a column of checkboxes that can be used to "check" individual rows in the gridview. During the gridview's "CreateColumns" event, the "checkboxcolumn" is created dynamically. The checkboxcolumn also contains another checkbox in the header that is used to "select/deselect all" checkboxes in the column. Since the gridview does not automatically remember the state of the checkboxes in the checkboxcolumn on postback, I added a method to the control called "SaveCheckBoxState" which stores the indexes of the checked rows in Viewstate, and then I modified the "OnRowDataBound" event to check the Viewstate and reset the checkboxes based on the Viewstate.
I then added a call to "SaveCheckBoxState" in the gridview's OnSorting and OnPageIndexChanging events. This works great so long as I'm sorting or changing pages. However, I need it to update the viewstate everytime someone clicks or unclicks one of the checkboxes. At this time, the checkboxes are rendered with an onclick event that calls some javascript to highlight the row, or in the case of the checkbox in the header, to select/deselect all checkboxes. I need to call the "SaveCheckBoxState" method from the javascript used by the customcontrol, or I need to find a way to modify viewstate from javascript and perform the same action as "SaveCheckBoxState".
I've tried adding the "SaveCheckBoxState" to the onclick event declaration in the checkboxes, but when run, it simply tells me that the method is undefined. It doesn't exist in the parent page, and I don't think I should have to make an event for the parent page to pass the click to. It seems to me this should be all self contained within the custom control. Does anyone know how I can acheive this? Here is the code for the gridview OnPreRender event where the onclick event of the checkbox is set:
protected override void OnPreRender(EventArgs e) { // Do as usual base.OnPreRender(e); // Adjust each data row foreach (GridViewRow r in Rows) { // Get the appropriate style object for the row TableItemStyle style = GetRowStyleFromState(r.RowState); // Retrieve the reference to the checkbox CheckBox cb = (CheckBox)r.FindControl(InputCheckBoxField.CheckBoxID); // Build the ID of the checkbox in the header string headerCheckBoxID = String.Format(CheckBoxColumHeaderID, ClientID); // Add script code to enable selection cb.Attributes["onclick"] = String.Format("ApplyStyle(this, '{0}', '{1}', '{2}')", SelectedRowStyle.CssClass, style.CssClass, headerCheckBoxID); // Update the style of the checkbox if checked if (cb.Checked) { r.BackColor = SelectedRowStyle.BackColor; r.ForeColor = SelectedRowStyle.ForeColor; r.Font.Bold = SelectedRowStyle.Font.Bold; } else { r.BackColor = style.BackColor; r.ForeColor = style.ForeColor; r.Font.Bold = style.Font.Bold; } } }
I have a custom control which inherit from the Table class and in the constructor, it takes a an integer as an argument. There is no empty constructor.
Is there a way for the user to set that variable in the properties window after they drag the control onto a form.
I know some .NET controls, you can set the source for the parameter to different things like another control's property, QueryString using just the properties window.
Right now, I have to create the control dynamically. I read the query string and then created the object.
How to display pages from the last to the first number in DataPager? Is there any tricks or I can do this with standart properties? I use Repeater with LinqDataSource control.
i mean to say how to decide the destination page depending on URL Eg:1.routes.MapPageRoute("carriers", "{state}/{mcat}/{dcat}", "~/carriers.aspx"); 2.routes.MapPageRoute("iphones", "{state}/{mcat}/{dcat}", "~/iphones.aspx");
if value in URL second parameter i.e mcat=cellphone then it must redirect to carriers.aspx. and if mcat=iphone then it must redirect to iphones.aspx page.
Problem:currently if in URL there are 3 parameters then it always goes to carriers.aspx as it searches in route table for 3 parameters it redirects to carriers.aspx which need to be conditionally redirected depending on mcat valuehow to do?
here's a situation and I would appreciate your response.
I have programmatically created the Wizard control:
Page_Load(obj s, evargs e) { Wizard ClaimDetailWizard = new Wizard(); foreach(int item in selectedItems) { //create new step //added custom control to new step //add step to wizard } //added wizard to a placeholder on a page }
Based on List I get from Session i added new steps to my wizard To each step I had added a custom control
Each custom control in tern contains another custom Gridview Control in it.
So here's the problem when the page loads for example for two steps. All is good Wizard does what it's supposed to do.
But when I try to use sorting or paging in that custom Gridview. Somehow it displays the gridview I should see in the next step of the wizard.
Also what I'm noticing through debugging. Is that when I press next in the wizard I go back to the original page where I do all of the code specified above, and it recreates the wizzard. But it goes to the next step. Is this the way wizard supposed to work? Just doesn't seem very efficient.
created a Custom Textbox Control that is intended to be a "masked date" textbox, so that I can handle different ways a user might enter in a date and make it work no matter what.I did this by creating a custom control with 3 separate Textboxes one for month,one for day one for year,then do some handling for different things that could be entered and it would all work.
The problem I am having is,when I add this control to the page,if I do an alert to check the Text value of the custom control it just gives me "[ServerControl1]" even if I enter in a date.
I tried doing an AutoPostback after entering so that it would refesh the Viewstate to have the values of the textboxes but the control doesnt seem to actually postback, even though I have it enabled.accessing the Textbox value after someoen has entered a date?first custom control I have created and have been using google.
I have created a user control and am ready to convert it into a custom control. I am trying to follow:
[URL] the steps mentioned in the link.
I am not seeing Build / Publish Web Site option.
I am using VS 2008. I only see Publish User Control but it doesn't give all the settings mentioned below. When I do publish user control, it just copies the ascx file to the desired location. how can I convert the user control to custom control.
My application I am using pagination.Using pagination i bind the records with listview control.
I generate the buttons dynamically according to the number of pages which is calculated from number of records returned from dataSource.when i click on a dynamically generated button its corresponding event handlers methods should get evaluated.Since asp.net page is stateless I can't keep the state of that dynamic controls after any postback.
Just Now I have seen the Article "How to get the Id of Control that cause postback in asp.net?". I got some idea from that article. Any example for "Creating link buttons dynamically and handling its corresponding event handler in Asp.Net".
I have a problem while printing rdlc report (local). The number of pages of the report in viewer is fewer than that in the print. This leads to a problem while printing the report from - to a particular page. For eg: The report viewer shows 9 pages while viewing but when I go for print it prints 14 pages. The data is not lost but records from page 1 are transfered to page 2 while printing.
I created an Extender which has a custom property that drills down a list XML elements from an xml file, where users can select xml elements during design-time. This works perfectly fine. However, my code only has a hardcoded xml filename (source of the xml elements list) and I need to change this by maxing the xml file user-specified.
What I did is that I created another control (panel) which has a custom property that when clicked (through the ellipsis), it will allow a developer to select the xml file which is supposed to be the source xml file that the Extenders shall use. The filedialog from custom panel's property works perfectly fine.
However, my problem now is that when I drag-drop my Extender, I cannot find a way to get the property value of the custom Panel Control which contains the xml filename. I tried creating a static variable which I thought the custom controls can share but VS2010 is breaking.
I'm using a ListView with a Paged DataSource. When the ObjectDataSource tries to fetch data from the "GetData"-method, the parameter PageSize is set to -1, even though I have set the PageSize to 8 in the DataPager.
I am new to asp.net and I have a problem. When the users insert in a editor for a decimal field something other than numbers, they get an error "Field name" is not a number. But I don't want them to receive this message I want them to receive another message. I have no problem with this with required and range validators. Is there any way for me to do this?
I am not refering necessarily to changing the culture just displaying another message.