Click here to Skip to main content
15,886,030 members

Comments by alexvw (Top 39 by date)

alexvw 25-Feb-19 9:22am View    
Hi there,

Almost; in your code you are using the same variable over and over: OrderNum will have the last value assigned to it.

It should be something like this:

string OrderNum = ((Label)iRow.Cells[0].Controls[1]).Text;
string OrderDate = ((Label)iRow.Cells[1].Controls[1]).Text;
etc...

CAUTION! if you are reading data from a cell that does not have a label or any other control inside of it, just read its text property:
string anotherVar = iRow.Cells[3].Text;

Cheers!
alexvw 6-Feb-19 15:18pm View    
Hi Anilananda,

ClientIDMode = "Static" does not reach the control's rendered name, that's why you can see the "ctl00$ContentPlaceholder1$txt1language" on the client's side.

There is a method, that I know of, to change it, but requires the creation of your own control, which must inherit the proper base class, e.g. TextBox, Lable, etc.

In your implementation, you would have to override the attributes (if I recall right) method that writes them out. In there, you would have to detect the name attribute and overwrite or replace it with the one you want.

I have never had time to get into that much of a detail.

Anyways, DO NOT attempt to replace you control's names in the response object, for such thing will invalidate all events for said controls.

Cheers!
alexvw 5-Feb-19 11:41am View    
Hi there,

The change you are seeing in your control's id is standard behavior of ASP.NET WebForms. Its purpose is to make sure your controls have a unique id.

You can change this by setting the ClientIDMode property at either page or control level; e.g.

Page Level:

<%@ Page Title="TestPage" Language="C#" MasterPageFile="~/UserMaster.master" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="project.test" ClientIDMode="Static"%>

Control Level:
<asp:TextBox ID="txtLanguage" runat="server" ClientIDMode="Static">.

Careful with this! if you set it up a page level, it will be up to you to ensure your controls have unique ids, otherwise, no javascript will work as expected, for it will not know how tell which control you what it to work on.

Hope this helps.
alexvw 5-Feb-19 11:35am View    
Hi there,

RootCore is a helper class I add to my projects, where I write methods that are of general interest/accessibility throughout the code.

The SetDisplayStyle method you can see, in the code example I sent you, is in charge of setting the display attribute of the style property of the signaled control. e.g. { style="display:none;" }

Cheers!
alexvw 1-Feb-19 14:32pm View    
Hi there,

I am afraid I can't give you a hand with Crystal Reports; I have not use them in more than 10 years.

Sorry.