iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I am using a ColumnType of "Template" for a asp:LinkButton
<ISWebGrid:WebGridColumn Name="View_WebGridColumn" Bound="false" EditType="NoEdit" ColumnType="Template" Caption=" " Width="50px" > <CellStyle ForeColor="Black" /> <CellTemplate> <asp:LinkButton ID="PDF_LinkButton" runat="server" OnCommand="Command_Button_Click" /> </CellTemplate> </ISWebGrid:WebGridColumn>
In the WebGrid IntializeRow Server Side Event I set the following for the LinkButton
- Visible- CommandArgument- CommandName- Text- ToolTip
protected void _WebGrid_InitializeRow(object sender, RowEventArgs e) { if (e.Row.Type == RowType.Record) { WebGridCellCollection _WebGridCellCollection = e.Row.Cells; DataRowView _DataRow = e.Row.DataRow as DataRowView; Int32 CallNumber_Int32 = Convert.ToInt32(_DataRow["CALLNUM1"].ToString()); String AgentCode_String = AgentCode_TextBox.Text; LinkButton PDF_LinkButton = (LinkButton) e.Row.Cells[1].GetTemplateContainer().FindControl("PDF_LinkButton"); PDF_LinkButton.Visible = false; PDF_LinkButton.CommandArgument = CallNumber_Int32.ToString(); PDF_LinkButton.CommandName = "QuoteView"; PDF_LinkButton.Text = "View"; PDF_LinkButton.ToolTip = "View Assessment"; // PDF String FileFormat_String = ""; String FileName_String = ""; String FilePath_String = ""; FileFormat_String = Common.ServiceQuoteFileType(); //Desired format goes here (PDF, Excel, or Image) FileName_String = Common.ServiceQuoteFileName(AgentCode_String, Convert.ToInt32(CallNumber_Int32)); FilePath_String = Common.ServiceQuoteFilePath(FileName_String); if (File.Exists(FilePath_String)) { PDF_LinkButton.Visible = true; } } }
The Page renders OK.
However, when I click on the Link Button, the Command_Button_Click Server-Side Event shows the CommandArgument and CommandName being empty.
protected void Command_Button_Click(Object sender, CommandEventArgs e) { switch (e.CommandName) { case "QuoteView": ... break; } }
What am I doing wrong?
How can I access the the CommandArgument and CommandName set in _WebGrid_InitializeRow in the Command_Button_Click Server Side Event?
Thanks,
Doug
Based on my discussion with the developer, setting the value during the InitializeRow server side event will be too late. You will need to assign the CommandName and CommandArgument earlier in the life cycle. Our suggestion will be to assigned it in the designer using the bind keyword. Here is the snippet:
<ISWebGrid:WebGridColumn Name="View_WebGridColumn" Bound="false" EditType="NoEdit" ColumnType="Template" Caption=" " Width="50px"> <CellStyle ForeColor="Black" /> <CellTemplate> <asp:LinkButton ID="PDF_LinkButton" runat="server" OnCommand="Command_Button_Click" CommandName="QuoteView" CommandArgument='<%# Bind("CALLNUM1") %>'/> </CellTemplate></ISWebGrid:WebGridColumn>
Thanks, that did it.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname