DataControlButton CreateButton (string text, string image, string command, string arg)\r
{\r
DataControlButton c = new DataControlButton (Control, text, image, command, arg, false);\r
- //c.CausesValidation = CausesValidation;\r
+ c.ButtonType = ButtonType;\r
+ if (CausesValidation) {\r
+ if (command == DataControlCommands.UpdateCommandName || command == DataControlCommands.InsertCommandName) {\r
+ c.Container = null;\r
+ c.CausesValidation = true;\r
+ c.ValidationGroup = ValidationGroup;\r
+ }\r
+ }\r
return c;\r
}\r
\r
AllowCallback = allowCallback;
}
+ public Control Container {
+ get { return container; }
+ set { container = value; }
+ }
+
public string ImageUrl {
get {
object o = ViewState["iu"];
{
string postScript = null;
string callScript = null;
-
+ PostBackOptions ops = null;
+
IPostBackContainer pcner = container as IPostBackContainer;
if (pcner != null) {
- PostBackOptions ops = pcner.GetPostBackOptions (this);
- postScript = container.Page.ClientScript.GetPostBackEventReference (ops);
- } else
- postScript = Page.ClientScript.GetPostBackEventReference (this, "");
-
- if (CausesValidation && Page.Validators.Count > 0) {
- // TOSHOK: review if this is the correct usage of the "fresh" client side stuff
- ClientScriptManager csm = new ClientScriptManager (Page);
- postScript = csm.GetClientValidationEvent () + postScript;
+ ops = pcner.GetPostBackOptions (this);
+ ops.RequiresJavaScriptProtocol = ButtonType == ButtonType.Link;
}
+ else
+ ops = GetPostBackOptions ();
+
+ postScript = Page.ClientScript.GetPostBackEventReference (ops);
if (AllowCallback) {
ICallbackContainer ccner = container as ICallbackContainer;
if (ButtonType == ButtonType.Link) {
if (callScript != null) {
writer.AddAttribute (HtmlTextWriterAttribute.Onclick, callScript);
- writer.AddAttribute (HtmlTextWriterAttribute.Href, "javascript:");
}
- else
- writer.AddAttribute (HtmlTextWriterAttribute.Href, "javascript:" + postScript);
+ writer.AddAttribute (HtmlTextWriterAttribute.Href, postScript);
writer.RenderBeginTag (HtmlTextWriterTag.A);
writer.Write (Text);
writer.RenderEndTag ();
else
writer.AddAttribute (HtmlTextWriterAttribute.Onclick, postScript);
- writer.AddAttribute (HtmlTextWriterAttribute.Type, "submit");
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, "button");
writer.AddAttribute (HtmlTextWriterAttribute.Name, ClientID);
writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);
writer.RenderBeginTag (HtmlTextWriterTag.Input);
}
}
}
+
+ protected override PostBackOptions GetPostBackOptions () {
+ PostBackOptions options = new PostBackOptions (this);
+ options.Argument = "";
+ options.RequiresJavaScriptProtocol = ButtonType == ButtonType.Link;
+ options.ClientSubmit = true;
+ options.PerformValidation = CausesValidation && Page != null && Page.AreValidatorsUplevel (ValidationGroup);
+ if (options.PerformValidation)
+ options.ValidationGroup = ValidationGroup;
+
+ return options;
+ }
private void EnsureForeColor () {
if (ForeColor != Color.Empty)
}
[Test]
- [Category ("NotWorking")]
public void GridView_Sort_and_DataSourceSelectArguments () {
DataSourceView view;
DataSourceSelectArguments arg;
// contains the arguments passed to the data source. In this implementation,
// the DataSourceSelectArguments object contains the arguments for paging operations.
[Test]
- [Category ("NotWorking")]
public void GridView_CreateDataSourceSelectArguments () {
DataSourceView view;
Page p = new Page ();
}
[Test]
- [Category ("NotWorking")]
public void GridView_GetCallbackResult()
{
Page page = new Page ();
}
[Test]
- [Category ("NotWorking")]
public void GridView_PrepareControlHierarchy ()
{
PokerGridView gv = new PokerGridView ();
}
[Test]
- [Category ("NotWorking")]
public void GridView_RenderingButtonField ()
{
string RenderedPageHtml = new WebTest (PageInvoker.CreateOnLoad (RenderingButtonField)).Run ();
+