jjzjj

c# - 图片上传不工作总是得到假值

coder 2024-05-25 原文

用户界面 图片上传部分不工作,我想在数据库中上传图片路径但不工作,没有正确绑定(bind)无法保存,你能帮我吗,显示上传图片值的表总是FALSE ASPX

<asp:TemplateField HeaderText="Images">
   <ItemTemplate>
      <asp:FileUpload runat="server"  AutoPostBack="True"  ID="fileupload" CommandArgument='<%# Eval("strImage") %>' ClientIDMode="Static"/>
   </ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
   <ItemTemplate>
      <asp:Image ImageUrl="~/Uploaded Images/Default.png" runat="server" ID="image"  Width="40" Height="40"/>
   </ItemTemplate>
</asp:TemplateField>

代码

     #region Detail Save1
        private DataTable CreateDetailSave()
        {
            DataTable dtDetailSave1 = new DataTable();
            DataColumn dc1;
            dc1 = new DataColumn("intArticleDetailId");
            dtDetailSave1.Columns.Add(dc1);
            dc1 = new DataColumn("intSectionId");
            dtDetailSave1.Columns.Add(dc1);
            dc1 = new DataColumn("intCompoundId");
            dtDetailSave1.Columns.Add(dc1);            
            dc1 = new DataColumn("decSectionWeight");
            dtDetailSave1.Columns.Add(dc1);
            dc1 = new DataColumn("intMessageId");
            dtDetailSave1.Columns.Add(dc1);
            dc1 = new DataColumn("strImage");
            dtDetailSave1.Columns.Add(dc1);

            foreach (GridViewRow row in gvArticle.Rows)
            {
                DataRow dr = dtDetailSave1.NewRow();

                Label lblintArticleDetailId = (Label)row.FindControl("lblArticleDetailId");
                Label lblSectionId = (Label)row.FindControl("lblSectionId");
                DropDownList ddlCompound = (DropDownList)row.FindControl("ddlCompoundId");
                TextBox txtdecSectionWeighte = (TextBox)row.FindControl("txtdecSectionWeighte");
                DropDownList intMessage = (DropDownList)row.FindControl("ddlMessage");

                FileUpload fileupload = (FileUpload)row.FindControl("fileupload");

                dr["intArticleDetailId"] = CurrentMode == "Add" ? -1 : Convert.ToInt32(lblintArticleDetailId.Text);

                dr["intSectionId"] = Convert.ToInt32(lblSectionId.Text);
                dr["intCompoundId"] = ddlCompound.SelectedValue;
                dr["decSectionWeight"] = txtdecSectionWeighte.Text.Trim() != "" ? Convert.ToDecimal(txtdecSectionWeighte.Text.Trim()) : 0;
                dr["intMessageId"] = intMessage.SelectedValue;
                dr["strImage"] = fileupload.HasFile;

                dtDetailSave1.Rows.Add(dr);
            }
            return dtDetailSave1;
        }
        #endregion

         #region pageload
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {

                ClearControls();

                FillArticleDetails();

                EnableControls(false);
                Session["SearchPopup"] = false;

            }
            else
            {
                if (Session["SearchPopup"] != null)
                {
                    SearchPopup = (bool)(Session["SearchPopup"]);
                    if (SearchPopup != false)
                    {
                        MyMPE.Show();
                    }
                    else
                    {
                        MyMPE.Hide();
                    }
                }

                vAdSearchParaList = new List<SearchParametors>();

            }
        }
        #endregion
 #region Create Article table
        private void createArticleDataTable()
        {
            if (dt.Columns.Count == 0)
            {
                dt.Columns.Add(new DataColumn("intArticleDetailId", typeof(int)));
                dt.Columns.Add(new DataColumn("intSectionId", typeof(int)));
                dt.Columns.Add(new DataColumn("strSectionName", typeof(string)));
                dt.Columns.Add(new DataColumn("intCompoundId", typeof(string)));
                dt.Columns.Add(new DataColumn("decSectionWeight", typeof(string)));
                dt.Columns.Add(new DataColumn("intMessageId", typeof(string)));
                dt.Columns.Add(new DataColumn("fileupload", typeof(string)));

            }

            gvArticle.DataSource = dt;
            gvArticle.DataBind();
        }        
        #endregion

        #region Compound Grid - Add empty row
        private void ArticleGridAddEmptyRow(int newId)
        {
            DataRow newDr = null;
            newDr = dt.NewRow();
            newDr["intArticleDetailId"] = 1;
            newDr["intSectionId"] = 1;
            newDr["strSectionName"] = "";
            newDr["intCompoundId"] = "";
            newDr["decSectionWeight"] = "";
            newDr["intMessageId"] = "";
            newDr["strImage"] = "";

            dt.Rows.Add(newDr);

            if (dtArticleDetails == null || dtArticleDetails.Rows.Count == 0)
            {
                dtArticleDetails = dt;
            }
            else
            {
                dtArticleDetails.Merge(dt);

                gvArticle.DataSource = dt;
                gvArticle.DataBind();
            }
        }
        #endregion

protected void gvArticle_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = gvArticle.Rows[e.RowIndex];
            FileUpload fu = row.Cells[0].FindControl("strImage") as FileUpload;
            if (fu != null && fu.HasFile)
            {
                fu.SaveAs(Server.MapPath("~/Uploaded Images" + fu.FileName));
            }
        }

完整的 aspx

                    <asp:GridView ID="gvArticle" ShowHeaderWhenEmpty="True" CssClass="table table-bordered table-condensed table-hover" AutoGenerateColumns="False" runat="server" AllowPaging="True" PageSize="15" OnRowDataBound="gvArticle_RowDataBound" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Horizontal" OnRowUpdating="gvArticle_RowUpdating">
                                                 <%--<HeaderStyle BackColor="#3d4247" ForeColor="White" />--%>
                                                            <Columns>
                                                                <asp:TemplateField HeaderText="intArticleDetail" Visible="false">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblArticleDetailId" Width="2" Text='<%# Bind("intArticleDetailId") %>' ClientIDMode="Static" runat="server"></asp:Label> 
                                                                    </ItemTemplate>
                                                                </asp:TemplateField> 

                                                                <asp:TemplateField HeaderText="SectionID" Visible="false">
                                                                     <ItemTemplate>
                                                                        <asp:Label ID="lblSectionId" Width="2" Text='<%# Bind("intSectionId") %>' ClientIDMode="Static" runat="server"></asp:Label> 
                                                                     </ItemTemplate>
                                                                </asp:TemplateField>                                                        

                                                                <asp:TemplateField HeaderText="Section">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblSectionName" Width="100"  Text='<%# Bind("strSectionName") %>' ClientIDMode="Static" runat="server"></asp:Label> 
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>  
                                                                <asp:TemplateField HeaderText="Compound">
                                                                        <EditItemTemplate>
                                                                            <asp:Label ID="lblItemTypeEdit" Width="50" Text='<%# Bind("strCompoundName") %>' lientIDMode="Static" AutoPostBack="true" runat="server">                                                                               
                                                                            </asp:Label>
                                                                        </EditItemTemplate>

                                                                        <ItemTemplate>
                                                                            <asp:DropDownList ID="ddlCompoundId" Width="200" CssClass="form-control my-DropDownThin" lientIDMode="Static" AutoPostBack="true" runat="server">                                                                               
                                                                            </asp:DropDownList>
                                                                        </ItemTemplate>
                                                                 </asp:TemplateField>


                                                                <asp:TemplateField HeaderText="Weight">
                                                                    <ItemTemplate>
                                                                        <asp:TextBox ID="txtdecSectionWeighte" Width="100%" Text='<%# Bind("decSectionWeight") %>' lientIDMode="Static" runat="server">  </asp:TextBox>                                                                            
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>

                                                                <%--<asp:TemplateField HeaderText="Messagers">                                                                
                                                                    <ItemTemplate>
                                                                        <asp:TextBox ID="txtMessage" Width="100%" Text='<%# Bind("intMessageId") %>' ClientIDMode="Static" runat="server"></asp:TextBox>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>--%>

                                                                 <asp:TemplateField HeaderText="Messagers">
                                                                        <EditItemTemplate>
                                                                            <asp:Label ID="lblMessageId" Width="50" Text='<%# Bind("strMessage") %>' ClientIDMode="Static" AutoPostBack="true" runat="server">                                                                               
                                                                            </asp:Label>
                                                                        </EditItemTemplate>

                                                                        <ItemTemplate>
                                                                            <asp:DropDownList ID="ddlMessage" Width="300" CssClass="form-control my-DropDownThin" lientIDMode="Static" AutoPostBack="true" runat="server">                                                                               
                                                                            </asp:DropDownList>
                                                                        </ItemTemplate>
                                                                 </asp:TemplateField>

                                                                <asp:TemplateField HeaderText="Images">                                                                
                                                                    <ItemTemplate>


                                                              <asp:FileUpload runat="server"  AutoPostBack="True"  ID="uploadFImage" CommandArgument='<%# Eval("strImage") %>' ClientIDMode="Static"/>

                                                                    </ItemTemplate>
                                                                </asp:TemplateField> 


                                                                   <asp:TemplateField HeaderText="">                                                                
                                                                    <ItemTemplate>


  <asp:Image ImageUrl="~/Uploaded Images/Default.png" runat="server" ID="btnViewFImage"  Width="40" Height="40"/>

                                                                    </ItemTemplate>
                                                                </asp:TemplateField> 

                                                            </Columns>

                                                 <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
                                                 <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
                                                 <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
                                                 <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
                                                 <SortedAscendingCellStyle BackColor="#F7F7F7" />
                                                 <SortedAscendingHeaderStyle BackColor="#4B4B4B" />
                                                 <SortedDescendingCellStyle BackColor="#E5E5E5" />
                                                 <SortedDescendingHeaderStyle BackColor="#242121" />

                                            </asp:GridView>    
                                        </div>
  </ContentTemplate>
       <Triggers>           
            <asp:PostBackTrigger ControlID="gvArticle"/> 
           </Triggers>

                                    </asp:UpdatePanel> 
                                    </div>
                                </div>

gvArticle_rowdatabound

protected void gvArticle_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Footer)
            {


            }
            else if (e.Row.RowType == DataControlRowType.DataRow)
            {


                { 


                }

                DataTable CompoundCode = clsArticle.CompoundDataForGrid("");

                DropDownList ddlCompoundId = (DropDownList)e.Row.FindControl("ddlCompoundId");
                if (ddlCompoundId != null)
                {
                    ddlCompoundId.DataTextField = "Compound Code";
                    ddlCompoundId.DataValueField = "Compound Id";
                    ddlCompoundId.DataSource = CompoundCode;
                    ddlCompoundId.DataBind();

                    string country = (e.Row.FindControl("ddlCompoundId") as DropDownList).Text;
                    ddlCompoundId.Items.FindByValue(country).Selected = true;
                }


                DataTable MsgCode = clsArticle.MessageDataForGrid("");

                DropDownList ddlMessage = (DropDownList)e.Row.FindControl("ddlMessage");
                if (ddlMessage != null)
                {
                    ddlMessage.DataTextField = "Message Name";
                    ddlMessage.DataValueField = "Message Id";
                    ddlMessage.DataSource = MsgCode;
                    ddlMessage.DataBind();

                    ddlMessage.Items.Insert(0, new ListItem("Please select"));
                    string country = (e.Row.FindControl("ddlMessage") as DropDownList).Text;
                    ddlMessage.Items.FindByValue(country).Selected = true;
                }



                //}


            }
        }

最佳答案

您的代码有很多问题。 首先,FileUpload 控件没有 AutoPostBack 属性以及 CommandArgument 属性,因此您需要在每一行中有一个按钮。

.aspx片段

<asp:TemplateField HeaderText="upload">
    <ItemTemplate>
        <asp:FileUpload ID="fileupload" AutoPostBack="true"  runat="server" />
    </ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="upload">
    <ItemTemplate>
        <asp:Button ID="btnUpdate" Text="upload" OnClick="btnUpdate_Click" CommandArgument='<%#Eval("PK_FIELD") %>' runat="server" />
    </ItemTemplate>
</asp:TemplateField>

.aspx.cs片段

protected void btnUpdate_Click(object sender, EventArgs e)
{
    FileUpload fu = 
      ((GridViewRow)((WebControl)sender).NamingContainer)
          .FindControl("fileupload") as FileUpload;
    bool ok = false;
    if (fu != null && fu.HasFile)
    {
        try
        {
            //possible issue here.
            //process NEED PERMISSION to write to this folder
            //also some checks with fu.PostedFile are recommended
            fu.SaveAs(Server.MapPath("~/images/" + fu.FileName));
            ok = true;
        }
        catch (Exception ex)
        {
            ok = false;
        }
    }
    if (ok)
    {
        //update DB table and GridViewRow image field.
    }
}

我希望这个解释有用并且可以接受。

根据你的gridview更新

    <asp:GridView ID="gvArticle" ShowHeaderWhenEmpty="True" CssClass="table
     table-bordered table-condensed table-hover" AutoGenerateColumns="False"
     runat="server" AllowPaging="True" PageSize="15" 
    OnRowDataBound="gvArticle_RowDataBound" 
 DataKeyNames="PK_field"  **important**
    >
        <%--<HeaderStyle BackColor="#3d4247" ForeColor="White" />--%>
        <Columns>
            <asp:TemplateField HeaderText="intArticleDetail" Visible="false">
            <ItemTemplate>
               <asp:Label ID="lblArticleDetailId" Width="2" 
Text='<%# Eval("intArticleDetailId") %>' **Bind is nonsense for label**
 runat="server"></asp:Label> **ClientIDMode="Static" remove everiwhere**
            </ItemTemplate>
            </asp:TemplateField> 

            <asp:TemplateField HeaderText="SectionID" Visible="false">
                 <ItemTemplate>
                    <asp:Label ID="lblSectionId" Width="2" Text='<%# Bind("intSectionId") %>' ClientIDMode="Static" runat="server"></asp:Label> 
                 </ItemTemplate>
            </asp:TemplateField>                                                        
        <asp:TemplateField HeaderText="Section">
            <ItemTemplate>
                <asp:Label ID="lblSectionName" Width="100"  Text='<%# Bind("strSectionName") %>' ClientIDMode="Static" runat="server"></asp:Label> 
            </ItemTemplate>
        </asp:TemplateField>  
        <asp:TemplateField HeaderText="Compound">
            <EditItemTemplate>** no edit mode remove**
                <asp:Label ID="lblItemTypeEdit" Width="50" 
Text='<%# Bind("strCompoundName") %>' ** see above**
ClientIDMode="Static" 
AutoPostBack="true" 
runat="server">                                                                               
                </asp:Label>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:DropDownList ID="ddlCompoundId" Width="200" 
    CssClass="form-control my-DropDownThin" ClientIDMode="Static" AutoPostBack="true" runat="server">                                                                               
                </asp:DropDownList>
            </ItemTemplate>
         </asp:TemplateField>
    <asp:TemplateField HeaderText="Weight">
    <ItemTemplate>
    <asp:TextBox ID="txtdecSectionWeighte" Width="100%" Text='<%# Bind("decSectionWeight") %>' ClientIDMode="Static" runat="server">  </asp:TextBox>                                                                            
    </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Messagers">                                                                
    <ItemTemplate>

    <asp:TextBox ID="txtMessage" Width="100%" Text='<%# Bind("intMessageId") %>' ClientIDMode="Static" runat="server"></asp:TextBox>
    </ItemTemplate>
</asp:TemplateField>--%>

        <asp:TemplateField HeaderText="Messagers">
    <EditItemTemplate>
    <asp:Label ID="lblMessageId" Width="50" Text='<%# Bind("strMessage") %>' ClientIDMode="Static" AutoPostBack="true" runat="server">                                                                               
    </asp:Label>
    </EditItemTemplate>

        <ItemTemplate>
    <asp:DropDownList ID="ddlMessage" Width="300" CssClass="form-control my-DropDownThin" ClientIDMode="Static" AutoPostBack="true" runat="server">                                                                               
    </asp:DropDownList>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Images">                                                                <ItemTemplate>
**work with upload. remove wrong attributes**
**AutoPostBack="True"CommandArgument='<%# Eval("strImage") %>' ClientIDMode="Static" ** 
          <asp:FileUpload runat="server" ID="uploadFImage" />
</ItemTemplate>
</asp:TemplateField> 
<asp:TemplateField HeaderText="">                                                                
<ItemTemplate>
<asp:Image ImageUrl="~/Uploaded Images/Default.png" runat="server" ID="btnViewFImage"  Width="40" Height="40"/>
</ItemTemplate>
</asp:TemplateField> 
</Columns>


     <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
     <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
     <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
     <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
     <SortedAscendingCellStyle BackColor="#F7F7F7" />
     <SortedAscendingHeaderStyle BackColor="#4B4B4B" />
     <SortedDescendingCellStyle BackColor="#E5E5E5" />
     <SortedDescendingHeaderStyle BackColor="#242121" />

</asp:GridView>    
** place update button outside to update all columns **
<asp:Button ID="btnUpdate" Text="upload" OnClick="btnUpdate_Click" runat="server" />

//.aspx.cs
    protected void btnUpdate_Click(object sender, EventArgs e)
{
foreach(GridViewRow row in gvArticle.rows)
{

    FileUpload fu = 
          row.FindControl("fileupload") as FileUpload;
    bool ok = false;
    if (fu != null && fu.HasFile)
    {
        try
        {
            //possible issue here.
            //process NEED PERMISSION to write to this folder
            //also some checks with fu.PostedFile are recommended
            fu.SaveAs(Server.MapPath("~/images/" + fu.FileName));
            ok = true;
        }
        catch (Exception ex)
        {
            ok = false;
        }
    }
    if (ok)
    {
        //update DB table and GridViewRow image field.
    }
}
}

关于c# - 图片上传不工作总是得到假值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37476300/

有关c# - 图片上传不工作总是得到假值的更多相关文章

  1. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  2. ruby-on-rails - 'compass watch' 是如何工作的/它是如何与 rails 一起使用的 - 2

    我在我的项目目录中完成了compasscreate.和compassinitrails。几个问题:我已将我的.sass文件放在public/stylesheets中。这是放置它们的正确位置吗?当我运行compasswatch时,它不会自动编译这些.sass文件。我必须手动指定文件:compasswatchpublic/stylesheets/myfile.sass等。如何让它自动运行?文件ie.css、print.css和screen.css已放在stylesheets/compiled。如何在编译后不让它们重新出现的情况下删除它们?我自己编译的.sass文件编译成compiled/t

  3. ruby - 无法让 RSpec 工作—— 'require' : cannot load such file - 2

    我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳

  4. ruby - 我可以使用 aws-sdk-ruby 在 AWS S3 上使用事务性文件删除/上传吗? - 2

    我发现ActiveRecord::Base.transaction在复杂方法中非常有效。我想知道是否可以在如下事务中从AWSS3上传/删除文件:S3Object.transactiondo#writeintofiles#raiseanexceptionend引发异常后,每个操作都应在S3上回滚。S3Object这可能吗?? 最佳答案 虽然S3API具有批量删除功能,但它不支持事务,因为每个删除操作都可以独立于其他操作成功/失败。该API不提供任何批量上传功能(通过PUT或POST),因此每个上传操作都是通过一个独立的API调用完成的

  5. ruby-on-rails - rspec should have_select ('cars' , :options => ['volvo' , 'saab' ] 不工作 - 2

    关闭。这个问题需要detailsorclarity.它目前不接受答案。想改进这个问题吗?通过editingthispost添加细节并澄清问题.关闭8年前。Improvethisquestion在首页我有:汽车:VolvoSaabMercedesAudistatic_pages_spec.rb中的测试代码:it"shouldhavetherightselect"dovisithome_pathit{shouldhave_select('cars',:options=>['volvo','saab','mercedes','audi'])}end响应是rspec./spec/request

  6. ruby-on-rails - s3_direct_upload 在生产服务器中不工作 - 2

    在Rails4.0.2中,我使用s3_direct_upload和aws-sdkgems直接为s3存储桶上传文件。在开发环境中它工作正常,但在生产环境中它会抛出如下错误,ActionView::Template::Error(noimplicitconversionofnilintoString)在View中,create_cv_url,:id=>"s3_uploader",:key=>"cv_uploads/{unique_id}/${filename}",:key_starts_with=>"cv_uploads/",:callback_param=>"cv[direct_uplo

  7. ruby-on-rails - Rails - 乐观锁定总是触发 StaleObjectError 异常 - 2

    我正在学习Rails,并阅读了关于乐观锁的内容。我已将类型为integer的lock_version列添加到我的articles表中。但现在每当我第一次尝试更新记录时,我都会收到StaleObjectError异常。这是我的迁移:classAddLockVersionToArticle当我尝试通过Rails控制台更新文章时:article=Article.first=>#我这样做:article.title="newtitle"article.save我明白了:(0.3ms)begintransaction(0.3ms)UPDATE"articles"SET"title"='dwdwd

  8. ruby-on-rails - 每次我尝试部署时,我都会得到 - (gcloud.preview.app.deploy) 错误响应 : [4] DEADLINE_EXCEEDED - 2

    我是Google云的新手,我正在尝试对其进行首次部署。我的第一个部署是RubyonRails项目。我基本上是在关注thisguideinthegoogleclouddocumentation.唯一的区别是我使用的是我自己的项目,而不是他们提供的“helloworld”项目。这是我的app.yaml文件runtime:customvm:trueentrypoint:bundleexecrackup-p8080-Eproductionconfig.ruresources:cpu:0.5memory_gb:1.3disk_size_gb:10当我转到我的项目目录并运行gcloudprevie

  9. c# - 如何在 ruby​​ 中调用 C# dll? - 2

    如何在ruby​​中调用C#dll? 最佳答案 我能想到几种可能性:为您的DLL编写(或找人编写)一个COM包装器,如果它还没有,则使用Ruby的WIN32OLE库来调用它;看看RubyCLR,其中一位作者是JohnLam,他继续在Microsoft从事IronRuby方面的工作。(估计不会再维护了,可能不支持.Net2.0以上的版本);正如其他地方已经提到的,看看使用IronRuby,如果这是您的技术选择。有一个主题是here.请注意,最后一篇文章实际上来自JohnLam(看起来像是2009年3月),他似乎很自在地断言RubyCL

  10. ruby-on-rails - Ruby on Rails - 为文本区域和图片生成列 - 2

    我是Rails的新手,所以请原谅简单的问题。我正在为一家公司创建一个网站。那家公司想在网站上展示它的客户。我想让客户自己管理这个。我正在为“客户”生成一个表格,我想要的三列是:公司名称、公司描述和Logo。对于名称,我使用的是name:string但不确定如何在脚本/生成脚手架终端命令中最好地创建描述列(因为我打算将其设置为文本区域)和图片。我怀疑描述(我想成为一个文本区域)应该仍然是描述:字符串,然后以实际形式进行调整。不确定如何处理图片字段。那么……说来话长:我在脚手架命令中输入什么来生成描述和图片列? 最佳答案 对于“文本”数

随机推荐