473,395 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

validating a custom control in a datagrid

hi,

i have a datagrid which display custom controls when user clicks edit,
changing data. I am using customvalidator to validate this control. I
can get validation of user input to work no problem when user clicks
on update in datagrid.

My problem is that when I try to get customvalidation to work when
user changes the value in the control, as i want this to be checked as
soon as user changes the control. The custom control offers an
OnServerChanged event which I can call the customvalidation but I
don't know how to access my custom validation control when I am in
this event. Does any know how i can do this?

Here is my code:

<asp:TemplateColumn HeaderStyle-CssClass="header"
HeaderText="Language">
<ItemTemplate>
<asp:Label runat="server" ID="lang"
Text='<%#DataBinder.Ev(Container.DataItem, "langname")%>'/>
</ItemTemplate>
<EditItemTemplate>
<ccl:combobox id="langEntry"
autopostback="true" runat="server" Style="FONT-FAMILY:verdana"
DataSource='<%# ListLanguageList() %>' DataTextField="lang"
DataValueField="langID">
</ccl:combobox>
<asp:CustomValidator
id="customcbval" Runat="server" ControlToValidate="langEntry"
OnServerValidate="cbLangCheck"
ErrorMessage="You must select
language from list" Display="Dynamic"></asp:CustomValidator>
</EditItemTemplate>
</asp:TemplateColumn>

//code-behind function which gets called when my custom control
changes

protected void langentry_textchanged(object sender, System.EventArgs
e)
{
// don't know how i can call my customvalidatot here
}
Nov 18 '05 #1
1 1733
<ph*****@vistatec.ie> wrote in message
news:a3**************************@posting.google.c om...
hi,

i have a datagrid which display custom controls when user clicks edit,
changing data. I am using customvalidator to validate this control. I
can get validation of user input to work no problem when user clicks
on update in datagrid.

My problem is that when I try to get customvalidation to work when
user changes the value in the control, as i want this to be checked as
soon as user changes the control. The custom control offers an
OnServerChanged event which I can call the customvalidation but I
don't know how to access my custom validation control when I am in
this event. Does any know how i can do this?

Here is my code:

<asp:TemplateColumn HeaderStyle-CssClass="header"
HeaderText="Language">
<ItemTemplate>
<asp:Label runat="server" ID="lang"
Text='<%#DataBinder.Ev(Container.DataItem, "langname")%>'/>
</ItemTemplate>
<EditItemTemplate>
<ccl:combobox id="langEntry"
autopostback="true" runat="server" Style="FONT-FAMILY:verdana"
DataSource='<%# ListLanguageList() %>' DataTextField="lang"
DataValueField="langID">
</ccl:combobox>
<asp:CustomValidator
id="customcbval" Runat="server" ControlToValidate="langEntry"
OnServerValidate="cbLangCheck"
ErrorMessage="You must select
language from list" Display="Dynamic"></asp:CustomValidator>
</EditItemTemplate>
</asp:TemplateColumn>

//code-behind function which gets called when my custom control
changes

protected void langentry_textchanged(object sender, System.EventArgs
e)
{
// don't know how i can call my customvalidatot here
}


You shouldn't need to call your custom validator. It should be called in the
normal course of events, when Page.Validate is called.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Julien | last post by:
Hi, I created a custom server control, compiled as a DLL (it's a composite server control). In my apsx page, I use something like : <MyAssembly:MyObject properties> <asp:datagrid />...
2
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx....
1
by: Vagabond Software | last post by:
I am creating a custom datagrid based, in part, from someone else's code. The author declared a derived datagrid class in a windows form, then declared a derived ColumnStyle class, in the same form,...
3
by: WebMatrix | last post by:
I am struggling with implementing somewhat complicated UI web-control. I explored Repeater, but I am not sure if it's the best way to go. I am leaning towards writing my own custom control and...
1
by: Sam Samnah | last post by:
Hi Everyone. It has been a long time since my last post. Nevertheless, I have built a custom server control that allows a user to edit text, bolding, italics strike though table insertion and...
7
by: Bruce HS | last post by:
I'd like to call my ancestor Validation Function every time any control on a Win Form generates a Validating or Validated event. I'm using VB. I've extended Textbox, for instance, to have its...
1
by: rn5a | last post by:
I have created a custom server control which is actually a Button clicking which prompts a user with a JavaScript confirm message asking him whether he would like to proceed or not. If he clicks...
8
by: clintonG | last post by:
I have to get to this later tonight or tommorrow...and wonder... There's two TextBoxes in a Wizard Step posing an either-or situtation. Only one or the other TextBox may pass data. The...
7
by: mc | last post by:
I've not been able to get a Check box to client side validated on postback. with my changes I can get it to work on the serverside ok but not on the client. I have created a new control as...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.