This is a migrated thread and some comments may be shown as answers.

HtmlButton in RadGrid

12 Answers 210 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Timyr
Top achievements
Rank 1
Timyr asked on 26 Oct 2011, 01:18 PM
Hi i have a problem! I have RadGrid and i have FormTemplate. In FormTemplate i have a html button (System.Web.UI.HtmlControls.HtmlInputSubmit) with runat = "server" and I can't find  this control(
System.Web.UI.HtmlControls.HtmlInputSubmit p = (System.Web.UI.HtmlControls.HtmlInputSubmit)item.FindControl("openWinbut") return null!!! If i find a aspnet Button then it doesn't return null! Help please)))

12 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Oct 2011, 05:37 AM
Hello Timyr,

Here is the sample code to access the html button.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
 if (e.Item is GridEditableItem && e.Item.IsInEditMode)
 {
    GridEditableItem item=(GridEditableItem)e.Item;
    HtmlInputSubmit btn = (HtmlInputSubmit)item.FindControl("btn1");
 }
}

Thanks,
Shinu.
0
Timyr
Top achievements
Rank 1
answered on 27 Oct 2011, 01:59 PM
Thanks! But look! I have a button like this
<input id="openWinbutEn" type="submit" onclick="OpenWindow('<%#Eval("Id")%>'); return false;" runat="server" value="Change anket"/>
 and this button opening a RadWindow. And I can't find it...
0
Timyr
Top achievements
Rank 1
answered on 29 Oct 2011, 10:20 PM
Why  <input id="openWinbutEn" type="submit" onclick="OpenWindow('<%#Eval("Id")%>'); return false;" runat="server" value="Change anket"/> is work but <asp:Button ID="btn" onClientclick="OpenWindow('<%#Eval("Id")%>'); return false;"/> doesn't work? 
0
Iana Tsolova
Telerik team
answered on 30 Oct 2011, 05:36 PM
Hi Timyr,

The ASP:Button should have runat="server". Otherwise it will not work, either being inside the grid or outside.

Greetings,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Timyr
Top achievements
Rank 1
answered on 30 Oct 2011, 07:17 PM
Yes I know it! it have it! I forget write it here!
It looke like this
<asp:Button ID="btn" runat="server" onClientclick="OpenWindow('<%#Eval("Id")%>'); return false;"/> and it doesn't work
0
Iana Tsolova
Telerik team
answered on 31 Oct 2011, 05:41 AM
Hi Timyr,

Is the Web Site under .NET 4.0? If yes, try setting the Page ClientIDMode to AutoID and let me know if it makes any difference.

All the best,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Timyr
Top achievements
Rank 1
answered on 31 Oct 2011, 10:57 AM
No our site in .NET 3.5...
0
Iana Tsolova
Telerik team
answered on 31 Oct 2011, 11:21 AM
Hi Timyr,

Change the Button definition as below then:
<asp:Button ID="btn" runat="server" onClientclick='OpenWindow(\'<%#Eval("Id")%>\'); return false;'/>

Let me know if it works.

Best wishes,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Timyr
Top achievements
Rank 1
answered on 31 Oct 2011, 12:25 PM
It doesn't work(
0
Timyr
Top achievements
Rank 1
answered on 31 Oct 2011, 12:55 PM
OnClientClick='<%#Eval("Id", "return OpenWindow(\"{0}\")")%>' I find  this code and it work!
0
JB
Top achievements
Rank 2
answered on 29 Dec 2011, 06:30 PM
Tried this:

 

 

 


<
asp:Button ID="Button5" runat="server" Text="Open2" onClientclick='ShowModal(\'<%#Eval("id")%>\'); return false;'/>

 

 

 

 

 
and it doesn't work and got this error "Tag is not a well formed."

Any idea?


Thanks...

Joey


0
Elliott
Top achievements
Rank 2
answered on 29 Dec 2011, 07:08 PM
Joey
yeah
try using a RadButton
Tags
Grid
Asked by
Timyr
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Timyr
Top achievements
Rank 1
Iana Tsolova
Telerik team
JB
Top achievements
Rank 2
Elliott
Top achievements
Rank 2
Share this question
or