Advertisement
Advertisement
| 03.20.2008 at 08:00PM PDT, ID: 23259043 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: |
<asp:GridView ID="GridView1" runat="server"
DataKeyNames="lname" AutoGenerateColumns="False" >
<Columns>
<asp:TemplateField >
<ItemTemplate >
<asp:LinkButton id="one" commandname="two" runat ="server"
Text ='<%# Bind("id")%>' >
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
...
' this is code to assign command argument to a row index on creation of a row.
Protected Sub GridView1_RowCreated1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated
If e.Row.RowType = DataControlRowType.DataRow Then
Dim addButton As LinkButton = CType(e.Row.Cells(0).Controls(0), LinkButton) 'error
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.LinkButton'.
addButton.CommandArgument = e.Row.RowIndex.ToString()
End If
'here if i get the rowindex i just assign to a textbox to test but i dont get this far.
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
If (e.CommandName = "three") Then
TextBox1.Text = Convert.ToInt32(e.CommandArgument)
End Sub
|
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 03.20.2008 at 08:11PM PDT, ID: 21177867 |
| 03.20.2008 at 08:23PM PDT, ID: 21177926 |
| 03.20.2008 at 08:38PM PDT, ID: 21177973 |
| 03.20.2008 at 08:40PM PDT, ID: 21177979 |
| 03.20.2008 at 08:43PM PDT, ID: 21177989 |
| 03.20.2008 at 08:46PM PDT, ID: 21178002 |
| 03.20.2008 at 08:54PM PDT, ID: 21178030 |
| 03.20.2008 at 08:55PM PDT, ID: 21178034 |
| 03.20.2008 at 08:59PM PDT, ID: 21178046 |
| 03.20.2008 at 09:07PM PDT, ID: 21178071 |
| 03.20.2008 at 09:16PM PDT, ID: 21178104 |
| 03.20.2008 at 09:17PM PDT, ID: 21178107 |
| 03.20.2008 at 09:32PM PDT, ID: 21178167 |
| 03.20.2008 at 09:34PM PDT, ID: 21178173 |
| 03.20.2008 at 11:39PM PDT, ID: 21178484 |
| 03.20.2008 at 11:45PM PDT, ID: 21178498 |
| 03.21.2008 at 02:05AM PDT, ID: 21178768 |