validation columns against column

Hi

 Do anybody know some articles or codeexample of how to validate columns against a input Column.

B can be > A and B can be < C. If you in row ID write 55 for Column_B, it must be reject.

example:

ID        column_A  Column_B   Column_C
1              3               10             15
2              4               20             30
3              3                                45


   

0
fyn
6/1/2008 10:13:43 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

6 Replies
1055 Views

Similar Articles

[PageSpeed] 48
Get it on Google Play
Get it on Apple App Store

Give more details.. Where do you want thease validations??

Is it in a web form or are you talking about DB columns??

 

 


If this post was useful to you, please mark it as answer.

ClientSideAsp.Net | Blog
0
anzer
6/1/2008 12:57:57 PM

hi

 yes in a webform, gridview...

0
fyn
6/1/2008 6:22:42 PM

use rowdatabound command of your Gridview

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

{

 

TableCell tc0= e.Row.Cells[0];

TableCell tc1 = e.Row.Cells[1];

if (tc0.Text == tc1.Text)

{

 

}

//

}


"Mark as answered if you feel this helps you"
"Curiosity is Bliss"
Regards,

Ravi Kant Srivastava
(Sr. Consultant I)
Neudesic
Hyd'bad
INDIA
0
blurearc
6/1/2008 6:39:56 PM

hi

thanks, I don't know if I understand it correct

So  is e.Row.Cells[0] = first column ??? and e.Row.Cells[1] = second column ?

 Best regard

0
fyn
6/2/2008 8:25:44 PM

Hi fyn ,

You can write some javascript code.

see my sample,

 

    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable test = new DataTable();
        test.Columns.Add("col");
        DataRow dr = test.NewRow();
        dr["col"] = "data";
        test.Rows.Add(dr);
        this.GridView1.DataSource = test;
        GridView1.DataBind();
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            TextBox box1 = e.Row.FindControl("TextBox1") as TextBox;
            TextBox box2 = e.Row.FindControl("TextBox2") as TextBox;
            string script = "if(parseInt(document.getElementById('" + box1.ClientID + "').value) > parseInt(this.value)){ alert('enter bigger'); this.focus(); } ";
            box2.Attributes.Add("onblur",script);
        }
    }
  
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    </form>
 

Samu Zhang
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
0
Samu
6/3/2008 6:21:38 AM

Thanks great !!!

0
fyn
6/12/2008 8:50:09 PM
Reply:

Similar Artilces:

When is a column not a column?
I have several extremely similar datawindows that I have to maintain that go against the same table. Recently, I had to add a column to that table, and also add the column to ALL of these datawindows that go against this table. I added the column to the first datawindow, set up the edit control style, etc. I then did a copy/paste of the columns edit control to the remaining dw's (of course remembering to first add the column in SQL). Everything (update props, column specs, column props) seems to indicate that the pasted column is linked to the column I selected, HOWEVER, when I...

How to provide validation controls and events to the controls inside edititemtemplate column?
Hi,I have a template column which having the edititem template contains a dropdown list.I have attached the list values to the dropdown now i need to fire an event for this dropdown to itemslectedindexchanged event whenever the new item selected by the user..how will i achieve this polease? one more question in edititemtemplate we will get the textboxes for the columns which are readonly = false , what i want is in edit mode user will be modify the existing data right , ineed to validate that data.how can provide the validation controls withinn the edititem templatecolumn?CheersRam...

Dividing one column to 4 columns in the Repeater control
Hi Folks, The following is my Repeater-Control code that providing a list of 20 companies names. I'm getting all of the data in one long column and I would like to divide this one column to 4 columns. Is it possible? how can I do it in my code: <asp:Repeater ID="catlist" runat="server"> <HeaderTemplate> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> ...

validation message using column label, not column name
win2k / pb8.01 When I forget to enter a required value on a dw, I get a MessageBox like this Required value missing for COLUMN NAME on row N Please enter a value For legacy reasons my column name is called lineval and can't be changed I have set a column label in the datawindow painter to "Line Value" which would look a lot nicer in an error message. Is there anyway to specify in the dw to use the column label instead of the column name in the error message ? thanks Alex Well that's not a PB-generated error, so it must be in your code somewhere...

Writing a column after column
Hi all, I need to consolidate columns of data available across different directories into a single excel csv file. Usually we write to a file row after row but for the current task I have, it would be convenient to write the file column after column. Is there a file writing mode for this? If not, I guess, I will have to write the matrix row by row and then take a transpose. Let me know what you guys think and if you could share some skeleton of code for something like this would be great. Thanks. -vijay vijay wrote: > I need to consolidate columns of data available acro...

Only one table column in n-columns presentation style
Hi all, I think it�s better to explain our problem with an example. Any idea to do this data (2 records): ID: 1 DATE: 19/01/2000 OBS: 11111111111 22222222222 333333 aaaaaaaa line444ae q qwe qweqee ID: 2 DATE: 19/01/2000 OBS: ad asdasda as fffffffffff hhhhhhh mmmmmmmmmPPPPPPPPPP ooooo on one DataObject (something) like: ************ ID: 1 DATE: 19/01/2000 OBS: 111111111111 aaaaaaaa 444ae 22222222222 q qwe qweqee 333333 ************ ID: 2 DATE: 19/01/2000 OBS: ad asdasda as PPPPPPPPPP ...

How to place in DataGrids’s first column table’s column name, in second Datagrid’s column table’s column value?
Hello I use C#. I’m interesting are there samples solved my problem. Andrew. You will need to loop through the datasource of the datagrid or through the datagrid items and fetch the values for the second datagrid.Sonu Kapoor [MVP] Feel free to ask me any .NET question | Ajax Data Controls Forum Thank you! I solved my problem at the server cite. Andrew. ...

How we can change control from one column to specific column in datawindow
How we can change control from one column to specific column in datawindow programatically. Let's suppoose there are three column in datawindow 1: Name 2: address 3: Phone when we open the window, Tab or Cursor is on column 1 (Name) now i have one button ...i want to write code in that button...when i click that button control or tab or cursor goto the phone column. Please somebody tell me how i can do this... thanks noaman mughal SetColumn. -- Bruce Armstrong [TeamSybase] http://www.teamsybase.com Two new books on developing with PowerBuilder http://www.pb9...

to Calculated Columns, then to update another column in same table in ADO.NET
to get several Columns, then pass those Columns into  one function which will return  a result,then using the result to update another column in same table in ADO.NET, How can I do this? thanks. Hi   what ever information you given is not clear. so please give me  detail info.Ganesan  Clarity is required. Plz explain clearly wts u r requirement.Thank uBaba Thank uBabaPlease remember to click "Mark as Answer" on this post if it helped you. ...

DataGrid Column's Validator fires when Column is not visible
I have a template column that includes a dropdownlist and requiredfieldvalidator: <asp:DataGrid id="dgEdit" runat="server" CssClass="CostTable" GridLines="none" AutoGenerateColumns="false" > <Columns> <asp:TemplateColumn ItemStyle-Width="335px" > <ItemTemplate> <asp:DropDownList ID="cboCostItem" runat="server" Autopostback="true" /> <asp:RequiredFieldValidator ID="vreqCostItem" runat="server" ControlToValidate="cboCostItem" Text="*" Display="None" Enabl...

VB.NET 1.1 Searching through DataList Column by Column
Hi,I am trying to search through a DataList column by column.  I am doing this so that if each cell within that sector is empty then I will hide that column.  I have implemented a quick function in order to do this, however, it is searching through the datalist row by row.  Below is my code, with explanations of what the code is trying to do.  I think the problem is to do with the String sector.  Is there anyway that I can change the sector string so that it will iterate through the table (dataset) column by column.Code:Dim myData As Data.DataSet = dbAccess.getChildr...

remove a gridview column dynamically, removes controls in template columns
I have a interface with a treeview and a gridview. The gridview has two templatefields that handles insert/update/deletes. The gridview is handling editing of different tables so I create the other columns in the gridview dynamically as boundfields. The user selects the table to edit in the treeview. The problem I am having happens when the user selects a table to edit the second time. The code that executes removes all bound fields, (dynamically added when user selected the first table in the treeview), but not the two template fields, and then adds boundfields specifi...

[*-)]how to delete all columns except one column for the corresponding column name......?
hi friends,          i've a table with (columns) username, content,data,........... i need to delete all column names(i.e.,content,data,........) except username for the specified username. eg: consider username=mahendran. i've to delete the values in the content,data,...............for the username=mahendran. but username should exist.how to do that?pls help me......  ---------------------------------------------------Don't forget to "Mark as Answer" if you are satisfied. Use the following  DataTable.Columns.Rem...

in a grid how to find a particular column is bound column or template column
hi,  Any one know how to find a particular column is bound column or template column or button column,etc in a grid Advance thanks   hi...use this dim label1 as Label=ctype(GridView1.FindControl("name"),Label) Hope This HelpsBhaaratRemember to click "Mark as Answer" on the post that helps UMy Blog find a particular column is bound column or template column no to find that particular column  Hi,please excuse me if iam wrong.i found that bount columns values are directly renders to a <td>  where template columns create some cont...

Web resources about - validation columns against column - asp.net.presentation-controls

Cross-validation (statistics) - Wikipedia, the free encyclopedia
is a model validation technique for assessing how the results of a statistical analysis will generalize to an independent data set. It is mainly ...

Serena Williams eyes history, Caroline Wozniacki craves validation in women's US Open final
As Serena Williams eyes another slice of tennis history, Caroline Wozniacki is craving validation with a watershed US Open final triumph on Sunday ...

Travers Duncan asks High Court to strike down ICAC validation laws
ICAC could be sent back to the High Court as a challenge to new laws validating corruption findings looms.

Adam Scott proclaims Texas win as validation of No.1 ranking
... No.1 golfer, beating American Jason Dufner in the third hole of a play-off at the Colonial event. "It's a good feeling and maybe some validation ...

Hollande to sign gay marriage bill after Constitutional Council's validation
Hollande to sign gay marriage bill after Constitutional Council's validation People's Daily Online ... 26, 27, 28, 29, 30, 31. Jan, Feb, Mar, ...

Marketers, Get Ready for the 'Validation Era'
The public brands included has been engaging in a "friends" arms race. But there are signs that we know we overdid it.

Validation and Uncertainty
What an extraordinary conversation I had recently on Twitter. It started with Neil Killick’s statement that we should not consider our stories ...

Nvidia Icera 410 LTE Modem Passes AT&T Network Validation
... Today's news is a small step and logical precursor toward both goals, Nvidia's Icera 410 LTE and HSPA+ baseband has passed AT&T's network validation ...

Ting’s Q1 Subscriber Growth Suffers from Sprint’s New Unlocking Validation Process
Back in February, Sprint updated the process it uses to validate unlocked devices that customers want to utilize on other carriers or one of ...

[Android M Feature Spotlight] Stricter APK Validation Now Actually Checks If All Of An APK's Files Are ...
While you might file this one under "really? We weren't doing this already?" if you're a security expert, Google has added stricter validation ...

Resources last updated: 12/25/2015 7:46:22 PM