G
Guest
I hava a DataGrid with a bunch of columns. The first column ([0]) is a
Username and the last column is set up like this:
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="ProfileLBtn" runat="server"
CausesValidation="false" CommandName="Profile"
Text="Profile" />
</ItemTemplate>
</asp:TemplateColumn>
I don't want to actually use this last column to execute a Server-Side
function post-back at all. Instead, I want it to make a client-side
JavaScript call USING A VALUE FROM THE FIRST COLUMN FOR EACH ROW IN MY
DATAGRID.
I've tried doing this as follows...
protected void UsersDG_ItemCreated(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
string Username = e.Item.Cells[0].Text;
LinkButton LBtn = e.Item.FindControl("ProfileLBtn") as LinkButton;
LBtn.OnClientClick = "PopUserProfile('" + Username + "');
return(false);";
}
}
So everything about this works EXCEPT that the value of Username is always
EMPTY. Is this because during execution of "UsersDG_ItemCreated", the value
hasn't yet been populated?
Alex
Username and the last column is set up like this:
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="ProfileLBtn" runat="server"
CausesValidation="false" CommandName="Profile"
Text="Profile" />
</ItemTemplate>
</asp:TemplateColumn>
I don't want to actually use this last column to execute a Server-Side
function post-back at all. Instead, I want it to make a client-side
JavaScript call USING A VALUE FROM THE FIRST COLUMN FOR EACH ROW IN MY
DATAGRID.
I've tried doing this as follows...
protected void UsersDG_ItemCreated(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
string Username = e.Item.Cells[0].Text;
LinkButton LBtn = e.Item.FindControl("ProfileLBtn") as LinkButton;
LBtn.OnClientClick = "PopUserProfile('" + Username + "');
return(false);";
}
}
So everything about this works EXCEPT that the value of Username is always
EMPTY. Is this because during execution of "UsersDG_ItemCreated", the value
hasn't yet been populated?
Alex